Skip to content

Commit 7062560

Browse files
author
Roche Compaan
committed
last_set_entry was referenced before assignment
1 parent c36aa19 commit 7062560

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

roundup/backends/back_anydbm.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_anydbm.py,v 1.25 2002-01-22 05:06:08 rochecompaan Exp $
18+
#$Id: back_anydbm.py,v 1.26 2002-01-22 05:18:38 rochecompaan Exp $
1919
'''
2020
This module defines a backend that saves the hyperdatabase in a database
2121
chosen by anydbm. It is guaranteed to always be available in python
@@ -347,6 +347,7 @@ def pack(self, pack_before):
347347
for key in db.keys():
348348
journal = marshal.loads(db[key])
349349
l = []
350+
last_set_entry = None
350351
for entry in journal:
351352
(nodeid, date_stamp, self.journaltag, action,
352353
params) = entry
@@ -356,11 +357,12 @@ def pack(self, pack_before):
356357
# grab the last set entry to keep information on
357358
# activity
358359
last_set_entry = entry
359-
date_stamp = last_set_entry[1]
360-
# if the last set entry was made after the pack date
361-
# then it is already in the list
362-
if date_stamp < pack_before:
363-
l.append(last_set_entry)
360+
if last_set_entry:
361+
date_stamp = last_set_entry[1]
362+
# if the last set entry was made after the pack date
363+
# then it is already in the list
364+
if date_stamp < pack_before:
365+
l.append(last_set_entry)
364366
db[key] = marshal.dumps(l)
365367
if db_type == 'gdbm':
366368
db.reorganize()
@@ -453,6 +455,10 @@ def rollback(self):
453455

454456
#
455457
#$Log: not supported by cvs2svn $
458+
#Revision 1.25 2002/01/22 05:06:08 rochecompaan
459+
#We need to keep the last 'set' entry in the journal to preserve
460+
#information on 'activity' for nodes.
461+
#
456462
#Revision 1.24 2002/01/21 16:33:20 rochecompaan
457463
#You can now use the roundup-admin tool to pack the database
458464
#

0 commit comments

Comments
 (0)