[ZODB-Dev] how to deal with changes in package hierarchy?
Garry Hodgson
garry at sage.att.com
Mon May 10 10:40:28 EDT 2004
a colleague of mine is using zodb/zeo for an application.
while she used to store her python modules in a private
directory, she has recently changed to installing them in
a package under site-packages. i.e., where she used to:
import reportStore
she now does:
import fathom.reportStore as reportStore
the problem is, here existing zodb has the old reportStore
objects in it, and fails when she tries to get one out:
Traceback (most recent call last):
File "./reset_report.py", line 18, in ?
ospreyReports = root[ 'ospreyReports' ]
File "/usr/local/lib/python2.3/UserDict.py", line 19, in __getitem__
def __getitem__(self, key): return self.data[key]
File "lib.linux-i686-2.3/ZODB/Connection.py", line 547, in setstate
File "lib.linux-i686-2.3/ZODB/Connection.py", line 178, in _persistent_load
File "lib.linux-i686-2.3/ZODB/Connection.py", line 138, in __getitem__
File "lib.linux-i686-2.3/ZODB/DB.py", line 121, in _classFactory
ImportError: No module named reportStore
if we move the import before the "import ZODB", we get:
Traceback (most recent call last):
File "./reset_report.py", line 2, in ?
import fathom.reportStore as reportStore
File "/usr/local/lib/python2.3/site-packages/fathom/reportStore.py", line 6, in ?
class reportStore(Persistence.Persistent):
AttributeError: 'module' object has no attribute 'Persistent'
this is as expected, since ZODB is not set up yet.
so, is there a mechanism for dealing with things like this?
i imagine she's not the first person who ever needed to change
a package hierarchy, and still be able to access old data.
any help would be greatly appreciated.
----
Garry Hodgson, Technology Consultant, AT&T Labs
Be happy for this moment.
This moment is your life.
More information about the ZODB-Dev
mailing list