Updating to make unittests work

This commit is contained in:
Griatch 2014-05-11 19:41:37 +02:00
parent f3af089aac
commit cfd2f111f1
3 changed files with 12 additions and 3 deletions

View file

@ -325,7 +325,7 @@ class CmdCpAttr(ObjManipCommand):
to_obj.attributes.add(to_attr, srcvalue)
if ("move" in self.switches and not (from_obj == to_obj and
from_attr == to_attr)):
from_obj.del_attribute(from_attr)
from_obj.attributes.remove(from_attr)
string += "\nMoved %s.%s -> %s.%s." % (from_obj.name,
from_attr,
to_obj_name, to_attr)

View file

@ -389,7 +389,7 @@ class ObjectManager(TypedObjectManager):
return None
# copy over all attributes from old to new.
for attr in original_object.get_all_attributes():
for attr in original_object.attributes.all():
new_object.attributes.add(attr.key, attr.value)
# copy over all cmdsets, if any

View file

@ -128,11 +128,20 @@ class Attribute(WeakSharedMemoryModel):
key = property(lambda self: self.db_key)
strvalue = property(lambda self: self.db_strvalue)
category = property(lambda self: self.db_category)
lock_storage = property(lambda self: self.db_lockstorage)
model = property(lambda self: self.db_model)
attrtype = property(lambda self: self.db_attrtype)
date_created = property(lambda self: self.db_date_created)
def __lock_storage_get(self):
return self.db_lock_storage
def __lock_storage_set(self, value):
self.db_lock_storage = value
self.save(update_fields=["db_lock_storage"])
def __lock_storage_del(self):
self.db_lock_storage = ""
self.save(update_fields=["db_lock_storage"])
lock_storage = property(__lock_storage_get, __lock_storage_set, __lock_storage_del)
# Wrapper properties to easily set database fields. These are
# @property decorators that allows to access these fields using
# normal python operations (without having to remember to save()