that you can generate sequent numbers without having to worry about storing
the last generated number. This is done by gocept.sequence within the
annotation of an object you provide.
===============
gocept.sequence
===============
Sequences
=========
>>> import Persistence
>>> import zope.annotation.interfaces
>>> from zope.interface import implements
We need a testobject, where the SequenceGenerator stores his data:
>>> class Dummy(Persistence.Persistent):
... implements(zope.annotation.interfaces.IAttributeAnnotatable)
>>> test_object = zope.annotation.interfaces.IAnnotations(Dummy())
You get a SequenceGenerator by adapting to ISequenceGenerator:
>>> from gocept.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
=======
0.4 (unreleased)
----------------
0.31 (2008-07-21)
----------------
- added migration code and tests for the bugfix of release 0.3
- added README text and CHANGELOG
0.3 (2008-07-21)
----------------
- fixed a bug with Plone, where the dot in the annotation key caused an access
error
- improved readability of test cases
0.1
---
- initial release
Metadata
Release files for gocept.sequence 0.31
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gocept.sequence-0.31.tar.gz | 5.2 kB | Without provenance | Details for gocept.sequence-0.31.tar.gz |
Release files / gocept.sequence-0.31.tar.gz
| Download URL | gocept.sequence-0.31.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f6be26fde2929651a551805d25c7c6ccb21579ee8f95dcda753b748db58d795
|
|
BLAKE2b-256 checksum How to use checksums |
e80bdccf6e6fc62825a2d0a71566861393d18901b6f33a647ac4205ec75c0304
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for gocept.sequence 0.31
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.