Skip to content

Commit 99cb827

Browse files
author
Brian Kelley
committed
Changed to 1.56
13 worked-around a current metakit bug, so retiring properties now works correctly. metakit 2.9.2 has a bug when using "find" on ordered views, using multiple arguments for find doesn't work. Known Current Bugs: You can't change a class' key properly. This shouldn't be too hard to fix.
1 parent 8a26f19 commit 99cb827

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

roundup/backends/back_metakit.py

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: back_metakit.py,v 1.56 2004-01-26 17:07:56 wc2so1 Exp $
1+
# $Id: back_metakit.py,v 1.57 2004-01-27 18:10:48 wc2so1 Exp $
22
'''
33
Metakit backend for Roundup, originally by Gordon McMillan.
44
@@ -94,27 +94,16 @@
9494
# 12 Enumerated READ and READWRITE for the getview and getindexedview
9595
# These will probably be removed because they are not used
9696
#
97-
# Known Current Bugs:
98-
# It is currently is not possible to retire an id with name X
99-
# and add a new unretired property with name X.
100-
# Confused? Here is the regression test:
101-
#
102-
# self.assertRaises(ValueError, self.db.user.create)
97+
# Changed to 1.56
10398
#
104-
# newid = self.db.user.create(username="spam")
105-
# self.assertEqual(self.db.user.lookup('spam'), newid)
106-
# self.db.commit()
107-
# self.assertEqual(self.db.user.lookup('spam'), newid)
108-
# self.db.user.retire(newid)
109-
# self.assertRaises(KeyError, self.db.user.lookup, 'spam')
99+
# 13 worked-around a current metakit bug, so retiring properties now
100+
# works correctly.
101+
# metakit 2.9.2 has a bug when using "find" on ordered views,
102+
# using multiple arguments for find doesn't work.
110103
#
111-
# # use the key again now that the old is retired (metakit FAILS!!)
112-
# newid2 = self.db.user.create(username="spam")
113-
# self.assertNotEqual(newid, newid2)
114-
# # try to restore old node. this shouldn't succeed!
115-
# self.assertRaises(KeyError, self.db.user.restore, newid)
116-
#
117-
# self.assertRaises(TypeError, self.db.issue.lookup, 'fubar')
104+
# Known Current Bugs:
105+
# You can't change a class' key properly.
106+
# This shouldn't be too hard to fix.
118107
#
119108

120109
from roundup import hyperdb, date, password, roundupdb, security
@@ -475,7 +464,7 @@ def get(self, nodeid, propname, default=_marker, cache=1):
475464
'''
476465
'cache' exists for backwards compatibility, and is not used.
477466
'''
478-
view = self.getview()
467+
view = self.getview()
479468
id = int(nodeid)
480469
if cache == 0:
481470
oldnode = self.uncommitted.get(id, None)
@@ -784,9 +773,13 @@ def retire(self, nodeid):
784773
self.db.addjournal(self.classname, nodeid, _RETIRE, {})
785774
if self.key:
786775
iv = self.getindexview(READWRITE)
787-
ndx = iv.find(k=getattr(row, self.key),i=row.id)
788-
if ndx > -1:
776+
ndx = iv.find(k=getattr(row, self.key))
777+
# find is broken with multiple attribute lookups
778+
# on ordered views
779+
#ndx = iv.find(k=getattr(row, self.key),i=row.id)
780+
if ndx > -1 and iv[ndx].i == row.id:
789781
iv.delete(ndx)
782+
790783
self.db.dirty = 1
791784
self.fireReactors('retire', nodeid, None)
792785

0 commit comments

Comments
 (0)