Skip to content

Commit 3615b10

Browse files
author
Richard Jones
committed
ahhh, I understand now
1 parent df5df97 commit 3615b10

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

roundup/backends/back_gadfly.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: back_gadfly.py,v 1.2 2002-08-23 04:48:10 richard Exp $
1+
# $Id: back_gadfly.py,v 1.3 2002-08-23 04:58:00 richard Exp $
22
__doc__ = '''
33
About Gadfly
44
============
@@ -710,16 +710,16 @@ def getjournal(self, classname, nodeid):
710710
return res
711711

712712
def pack(self, pack_before):
713-
''' Pack the database, removing all journal entries before the
714-
"pack_before" date.
713+
''' Delete all journal entries except "create" before 'pack_before'.
715714
'''
716715
# get a 'yyyymmddhhmmss' version of the date
717716
date_stamp = pack_before.serialise()
718717

719718
# do the delete
720719
cursor = self.conn.cursor()
721720
for classname in self.classes.keys():
722-
sql = 'delete from %s__journal where date<?'%classname
721+
sql = "delete from %s__journal where date<? and "\
722+
"action<>'create'"%classname
723723
if __debug__:
724724
print >>hyperdb.DEBUG, 'pack', (self, sql, date_stamp)
725725
cursor.execute(sql, (date_stamp,))
@@ -1645,6 +1645,20 @@ def __init__(self, db, classname, **properties):
16451645

16461646
#
16471647
# $Log: not supported by cvs2svn $
1648+
# Revision 1.2 2002/08/23 04:48:10 richard
1649+
# That's gadfly done, mostly. Things left:
1650+
# - Class.filter (I'm a wuss ;)
1651+
# - schema changes adding new non-multilink properties are not implemented.
1652+
# gadfly doesn't have an ALTER TABLE command, making that quite difficult :)
1653+
#
1654+
# I had to mangle two unit tests to get this all working:
1655+
# - gadfly also can't handle two handles open on the one database, so
1656+
# testIDGeneration doesn't try that.
1657+
# - testNewProperty is disabled as per the second comment above.
1658+
#
1659+
# I noticed test_pack was incorrect, and the *dbm tests fail there now.
1660+
# Looking into it...
1661+
#
16481662
# Revision 1.1 2002/08/22 07:56:51 richard
16491663
# Whee! It's not finished yet, but I can create a new instance and play with
16501664
# it a little bit :)

test/test_db.py

Lines changed: 6 additions & 3 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: test_db.py,v 1.40 2002-08-23 04:48:36 richard Exp $
18+
# $Id: test_db.py,v 1.41 2002-08-23 04:58:00 richard Exp $
1919

2020
import unittest, os, shutil, time
2121

@@ -413,8 +413,8 @@ def testPack(self):
413413
self.db.pack(pack_before)
414414
journal = self.db.getjournal('issue', '1')
415415

416-
# we should have one entry now
417-
self.assertEqual(1, len(journal))
416+
# we should have the create and last set entries now
417+
self.assertEqual(2, len(journal))
418418

419419
def testIDGeneration(self):
420420
id1 = self.db.issue.create(title="spam", status='1')
@@ -668,6 +668,9 @@ def suite():
668668

669669
#
670670
# $Log: not supported by cvs2svn $
671+
# Revision 1.40 2002/08/23 04:48:36 richard
672+
# oops, forgot
673+
#
671674
# Revision 1.39 2002/07/31 23:57:37 richard
672675
# . web forms may now unset Link values (like assignedto)
673676
#

0 commit comments

Comments
 (0)