Implemented typeclass deleting; you can now do del obj.testval and expect the underlying attribute to be safely deleted from the database. Also fixed some reference errors when assigning to db/ndb properties on objects. Resolves issue 116. Fixed a bug in the command-testing system, so the few command tests that are defined should all work now.

This commit is contained in:
Griatch 2011-02-05 18:06:18 +00:00
parent 19538ff00b
commit 45941e0c69
6 changed files with 76 additions and 33 deletions

View file

@ -789,7 +789,7 @@ class TypedObject(SharedMemoryModel):
logger.log_trace()
return default
return attrib.value
else:
else:
return default
def del_attribute(self, attribute_name):
@ -863,14 +863,14 @@ class TypedObject(SharedMemoryModel):
def __init__(self, obj):
object.__setattr__(self, 'obj', obj)
def __getattribute__(self, attrname):
obj = object.__getattribute__(self, 'obj')
obj = object.__getattribute__(self, 'obj')
if attrname == 'all':
# we allow for overwriting the all() method
# with an attribute named 'all'.
attr = obj.get_attribute("all")
if attr:
return attr
return object.__getattribute__(self, 'all')
return object.__getattribute__(self, 'all')
return obj.get_attribute(attrname)
def __setattr__(self, attrname, value):
obj = object.__getattribute__(self, 'obj')