Updating to make unittests work
This commit is contained in:
parent
f3af089aac
commit
cfd2f111f1
3 changed files with 12 additions and 3 deletions
|
|
@ -325,7 +325,7 @@ class CmdCpAttr(ObjManipCommand):
|
||||||
to_obj.attributes.add(to_attr, srcvalue)
|
to_obj.attributes.add(to_attr, srcvalue)
|
||||||
if ("move" in self.switches and not (from_obj == to_obj and
|
if ("move" in self.switches and not (from_obj == to_obj and
|
||||||
from_attr == to_attr)):
|
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,
|
string += "\nMoved %s.%s -> %s.%s." % (from_obj.name,
|
||||||
from_attr,
|
from_attr,
|
||||||
to_obj_name, to_attr)
|
to_obj_name, to_attr)
|
||||||
|
|
|
||||||
|
|
@ -389,7 +389,7 @@ class ObjectManager(TypedObjectManager):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# copy over all attributes from old to new.
|
# 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)
|
new_object.attributes.add(attr.key, attr.value)
|
||||||
|
|
||||||
# copy over all cmdsets, if any
|
# copy over all cmdsets, if any
|
||||||
|
|
|
||||||
|
|
@ -128,11 +128,20 @@ class Attribute(WeakSharedMemoryModel):
|
||||||
key = property(lambda self: self.db_key)
|
key = property(lambda self: self.db_key)
|
||||||
strvalue = property(lambda self: self.db_strvalue)
|
strvalue = property(lambda self: self.db_strvalue)
|
||||||
category = property(lambda self: self.db_category)
|
category = property(lambda self: self.db_category)
|
||||||
lock_storage = property(lambda self: self.db_lockstorage)
|
|
||||||
model = property(lambda self: self.db_model)
|
model = property(lambda self: self.db_model)
|
||||||
attrtype = property(lambda self: self.db_attrtype)
|
attrtype = property(lambda self: self.db_attrtype)
|
||||||
date_created = property(lambda self: self.db_date_created)
|
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
|
# Wrapper properties to easily set database fields. These are
|
||||||
# @property decorators that allows to access these fields using
|
# @property decorators that allows to access these fields using
|
||||||
# normal python operations (without having to remember to save()
|
# normal python operations (without having to remember to save()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue