From a420ba9a313f973c9da12d0f72647107d2c2295d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Peters?= Date: Mon, 15 Dec 2008 12:50:35 +0100 Subject: [PATCH] restore object class after saving it; and make sure identities are added in the right directory --- extra/modules/stores.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/extra/modules/stores.py b/extra/modules/stores.py index 2fb722b..84ab850 100644 --- a/extra/modules/stores.py +++ b/extra/modules/stores.py @@ -63,6 +63,14 @@ class InheritingIdentityStore(authentic.identities.IdentitiesStoreStorage): t.__class__ = self.identity_class return t + def add(self, identity): + # make sure identity class is the correct one, and get a new id + # appropriate for that class + identity.__class__ = self.identity_class + identity.id = identity.get_new_id() + authentic.identities.IdentitiesStoreStorage.add(self, identity) + + class ParthenayIdentityStore(InheritingIdentityStore): def get_identity_for_account(self, account): @@ -98,8 +106,10 @@ def get_collectivity_identity_class(collectivity_id): if not os.path.exists(objects_dir): os.mkdir(objects_dir) self._filename = os.path.join(self._names, fix_key(self.id)) + old_class = self.__class__ self.__class__ = authentic.identities.Identity authentic.identities.Identity.store(self) + self.__class__ = old_class return CollectivityIdentity