From 0141f94e9dd8959723de3b72c258a8cb7639566d Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 14 Oct 2012 16:31:22 +0200 Subject: [PATCH] Fixed a bug in obj.copy() that tried to access contents without properly initializing the typeclass. Resolves Issue 288. --- src/objects/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/objects/models.py b/src/objects/models.py index 908bc2f968..f97785fb44 100644 --- a/src/objects/models.py +++ b/src/objects/models.py @@ -856,11 +856,11 @@ class ObjectDB(TypedObject): """ key = _GA(self, "key") num = 1 - for obj in (obj for obj in _GA(_GA(self, "location"), "contents") + for obj in (obj for obj in self.location.contents if obj.key.startswith(key) and obj.key.lstrip(key).isdigit()): num += 1 - return "%s%02i" % (key, num) - new_key = new_key or find_clone_key(self) + return "%s%03i" % (key, num) + new_key = new_key or find_clone_key() return ObjectDB.objects.copy_object(self, new_key=new_key) delete_iter = 0