From 8f4f1232303dc87c14ebb6bc1f4f7051e5530184 Mon Sep 17 00:00:00 2001 From: Griatch Date: Tue, 13 Nov 2012 21:34:42 +0100 Subject: [PATCH] Fixed a lingering call to the old caching scheme by swap_typeclass method. Resolves Issue 332. --- src/typeclasses/models.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/typeclasses/models.py b/src/typeclasses/models.py index b1ecc4fae1..a30a92d508 100644 --- a/src/typeclasses/models.py +++ b/src/typeclasses/models.py @@ -1241,24 +1241,20 @@ class TypedObject(SharedMemoryModel): # this is an actual class object - build the path cls = new_typeclass.__class__ new_typeclass = "%s.%s" % (cls.__module__, cls.__name__) + else: + new_typeclass = "%s" % to_str(new_typeclass) # Try to set the new path # this will automatically save to database - old_typeclass_path = self.typeclass_path - self.typeclass_path = new_typeclass.strip() + _SA(self, "typeclass_path", new_typeclass.strip()) # this will automatically use a default class if # there is an error with the given typeclass. new_typeclass = self.typeclass - if self.typeclass_path == new_typeclass.path: - # the typeclass loading worked as expected - _DA(self, "_cached_db_typeclass_path") - _SA(self, "_cached_typeclass", None) - elif no_default: + if self.typeclass_path != new_typeclass.path and no_default: # something went wrong; the default was loaded instead, # and we don't allow that; instead we return to previous. _SA(self, "typeclass_path", old_typeclass_path) - _SA(self, "_cached_typeclass", None) return False if clean_attributes: