products/CPSUid

changeset 35:c273505650d5 0.1.4

Don't make a micro transaction at first use of counter: it'd fail
author gracinet
date Thu, 30 Nov 2006 13:02:12 +0000
parents d23f3800bb10
children f2b9859fa397 5f36e0f627d9
files CHANGES uidcounter.py
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/CHANGES
     1.2 +++ b/CHANGES
     1.3 @@ -6,7 +6,7 @@
     1.4  -
     1.5  Bug fixes
     1.6  ~~~~~~~~~
     1.7 --
     1.8 +- (major) first use of counter failed
     1.9  New internal features
    1.10  ~~~~~~~~~~~~~~~~~~~~~
    1.11  - 
     2.1 --- a/uidcounter.py
     2.2 +++ b/uidcounter.py
     2.3 @@ -88,6 +88,13 @@
     2.4          returned values' unicity).
     2.5  
     2.6          """
     2.7 +	jar = self._p_jar
     2.8 +	if jar is None:
     2.9 +	   # creation of counter
    2.10 +           v = self.counter_start
    2.11 +           self.counter_current = v + 1
    2.12 +	   return v
    2.13 +
    2.14          db = self._p_jar.db()
    2.15  
    2.16          retries = self.max_tries