Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install cykooz.sequence

How to install cykooz.sequence

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install cykooz.sequence
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
1.0.2 Available View build log
1.0.1 Available View build log
1.0.0 Available View build log
Windows (64-bit)
1.0.2 Available View build log
1.0.1 Available View build log
1.0.0 Available View build log
Mac OS X (10.5+)
1.0.2 Available View build log
1.0.1 Available View build log
1.0.0 Available View build log
Linux (32-bit)
1.0.2 Available View build log
1.0.1 Available View build log
1.0.0 Available View build log
Linux (64-bit)
1.0.2 Available View build log
1.0.1 Available View build log
1.0.0 Available View build log
Web
 
Author
License
ZPL
Lastest release
version 1.0.2 on May 18th, 2011

This project is a fork of gocept.sequence (http://pypi.python.org/pypi/gocept.sequence/) originally created by Daniel Havlik and Sebastian Wehrmann.

cykooz.sequence

Generates a persistent sequence.

Sequences
>>> import persistent
>>> import zope.annotation.interfaces
>>> from zope.interface import implements

We need a testobject, where the SequenceGenerator stores his data:

>>> class Dummy(persistent.Persistent):
...     implements(zope.annotation.interfaces.IAttributeAnnotatable)
>>> test_object = Dummy()

You get a SequenceGenerator by adapting to ISequenceGenerator:

>>> from cykooz.sequence.interfaces import ISequenceGenerator
>>> seq_gen = ISequenceGenerator(test_object)

You get a sequence like this:

>>> seq_gen.getNextValue()
1
>>> seq_gen.getNextValue()
2
>>> seq_gen.getNextValue()
3

You can also set the generator to a value:

>>> seq_gen.setNextValue(1)
>>> seq_gen.getNextValue()
1
>>> seq_gen.setNextValue(5)
>>> seq_gen.getNextValue()
5
>>> seq_gen.getNextValue()
6
>>> seq_gen.getNextValue()
7
>>> seq_gen.getNextValue()
8

But setNextValue only accepts integer arguments:

>>> seq_gen.setNextValue('1')
Traceback (most recent call last):
...
ValueError: setNextValue expected Integer, <type 'str'> found.
>>> seq_gen.setNextValue(3.14)
Traceback (most recent call last):
...
ValueError: setNextValue expected Integer, <type 'float'> found.
Changes
1.0.2 (2011-05-17)
  • Fix tests.
1.0.1 (2011-05-16)
  • Fix interface name for getting annotations.
1.0.0 (2011-04-14)
  • Removed old migration code.
  • Removed the dependency from Persistence.

Subscribe to package updates

Last updated May 18th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.