From: rochecompaan Date: Tue, 22 Jan 2002 05:06:09 +0000 (+0000) Subject: We need to keep the last 'set' entry in the journal to preserve X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=84ec049394a5b35c35dae5981fc8f7bf37740b2e;p=roundup.git We need to keep the last 'set' entry in the journal to preserve information on 'activity' for nodes. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@578 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup/backends/back_anydbm.py b/roundup/backends/back_anydbm.py index bfdc142..cca1c86 100644 --- a/roundup/backends/back_anydbm.py +++ b/roundup/backends/back_anydbm.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -#$Id: back_anydbm.py,v 1.24 2002-01-21 16:33:20 rochecompaan Exp $ +#$Id: back_anydbm.py,v 1.25 2002-01-22 05:06:08 rochecompaan Exp $ ''' This module defines a backend that saves the hyperdatabase in a database chosen by anydbm. It is guaranteed to always be available in python @@ -352,6 +352,15 @@ class Database(hyperdb.Database): params) = entry if date_stamp > pack_before or action == 'create': l.append(entry) + elif action == 'set': + # grab the last set entry to keep information on + # activity + last_set_entry = entry + date_stamp = last_set_entry[1] + # if the last set entry was made after the pack date + # then it is already in the list + if date_stamp < pack_before: + l.append(last_set_entry) db[key] = marshal.dumps(l) if db_type == 'gdbm': db.reorganize() @@ -444,6 +453,9 @@ class Database(hyperdb.Database): # #$Log: not supported by cvs2svn $ +#Revision 1.24 2002/01/21 16:33:20 rochecompaan +#You can now use the roundup-admin tool to pack the database +# #Revision 1.23 2002/01/18 04:32:04 richard #Rollback was breaking because a message hadn't actually been written to the file. Needs #more investigation. diff --git a/test/test_db.py b/test/test_db.py index 1412b73..664dc56 100644 --- a/test/test_db.py +++ b/test/test_db.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: test_db.py,v 1.16 2002-01-21 16:33:20 rochecompaan Exp $ +# $Id: test_db.py,v 1.17 2002-01-22 05:06:09 rochecompaan Exp $ import unittest, os, shutil @@ -241,13 +241,16 @@ class anydbmDBTestCase(MyTestCase): def testPack(self): self.db.issue.create(title="spam", status='1') + self.db.commit() self.db.issue.set('1', status='2') self.db.commit() + self.db.issue.set('1', status='3') + self.db.commit() pack_before = date.Date(". + 1d") self.db.pack(pack_before) journal = self.db.getjournal('issue', '1') - self.assertEqual(1, len(journal)) + self.assertEqual(2, len(journal)) def testRetire(self): pass @@ -344,6 +347,9 @@ def suite(): # # $Log: not supported by cvs2svn $ +# Revision 1.16 2002/01/21 16:33:20 rochecompaan +# You can now use the roundup-admin tool to pack the database +# # Revision 1.15 2002/01/19 13:16:04 rochecompaan # Journal entries for link and multilink properties can now be switched on # or off.