I've fixed most of the show stopping bugs with the metakit backend.
There is one remaining which is a bug in the back_metakit retirement
system. This I expect to fix this week.
There is one non-backwards compatible fix that can be toggled, I've
added NULL values to booleans and Numbers which metakit does not
directly support. This is not turned on by default as it will break old
databases. Is there a progression for adding non-backwards compatible
In any case, here is the change list (which I also used as the change log)
1 Added an explicit close to the Indexer class. This was handled
by garbage collection before.
2 Added an MKBackendError exception that gets thrown on some metakit
Should there be a general rdbms exception?
3 Added a sanity check when creating metakit tables in __getview
There are some test cases that create columns of the same name
with different metakit types. This can cause crashing issues with
older version of metakit. We catch these before hand and raise
4 metakit db's cannot be weakref'd so this was removed
5 fixed a metakit.append, metakit must append lists, objects or
dictionaries, it can't handle scalars.
6 To make it easier to compare to the other backends
Class.keyname is changed to Class.key
7 Fixed Class.lookup, sometimes it would claim that a valid
row was not valid (an _isdel row _property of 0 would
be reported as 1) This is because metakit's view.find
operation was returning bad results. This should be
view.select or view.find on a single property.
8 calling create with no parameters raises a value error
I'm not sure if this is appropriate, but it fixes
a regression test :)
9 The get method was only converting results for commited
values. uncommited values were not being converted
using the metakit conversion table
10 Added a check to the Class.__init__ to raise a ValueError
if the database already has a class of the same name.
11 Boolean and Number types can now have null values. This
is a backwards incompatible fix in that old databases
won't work correctly.
The fix is simple. For a boolean column, 0 is now None
1 is False (returns 0)
2 is True (returns 1)
For a numeric column, 0 is now None
values 0 get returned as
values < 0 get returned as
Set the BACKWARDS_COMPATIBLE flag to False to enable this fix.
12 Enumerated READ and READWRITE for the getview and getindexedview
These will probably be removed because they are not used
Known Current Bugs:
It is currently is not possible to retire an id with name X
and add a new unretired property with name X.
Confused? Here is the regression test:
newid = self.db.user.create(username="spam")
self.assertRaises(KeyError, self.db.user.lookup, 'spam')
# use the key again now that the old is retired (metakit FAILS!!)
newid2 = self.db.user.create(username="spam")
# try to restore old node. this shouldn't succeed!
self.assertRaises(KeyError, self.db.user.restore, newid)
self.assertRaises(TypeError, self.db.issue.lookup, 'fubar')
Boolean and number values will not return None (now fixed but
breaks backwards compatibility)
This causes some regression tests to fix, namely:
x = password.Password('x')
nid = self.db.user.create(username='foo', password=x)
self.assertEqual(self.db.user.get(nid, "assignable"), None)