[Zope-CMF] Relocating the files in a ZOPE product
Dieter Maurer
dieter at handshake.de
Wed Jan 7 15:39:00 EST 2004
suresh_vv wrote at 2004-1-7 10:23 -0000:
>I tried to do this and found that the instances of the old product in
>my ZODB cannot be accessed anymore, even though I could create new
>instances.
>
>What gives?
Few will understand what you did and what problem you have ...
You should (really) post clearer questions.
I guess (really) that your renamed some source files defining
persistent objects. As a persistent object is represented
in the ZODB as "module-path + class-name + pickled-state",
it can no longer be instantiated when you change the module-path
or the class-name.
If I am right, I see two options for you:
1. create backward compatibility modules (under the old
"module-path") with the content:
from new-module-path import new-class-name as old-class-name
2. use the "__module_aliases__" feature in the product's
"__init__.py" file.
I am not sure, whether this feature is documented (if it is,
it is probably in the Zope Developper Guide).
You find an example (e.g.) in "PythonScripts".
--
Dieter
More information about the Zope-CMF
mailing list