[ZODB-Dev] how to deal with changes in package hierarchy?

Dieter Maurer dieter at handshake.de
Mon May 10 13:32:02 EDT 2004


Garry Hodgson wrote at 2004-5-10 10:40 -0400:
>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:

This is something difficult as both the object itself as well
as references to it contain the class location (as a Python dotted path).

Avoid changing the module hierarchy.

If this is impossible, use "redirecting" modules, e.g.

   reportStore.py:
      from fathom.reportStore import *


You can add aliases into "sys.modules", e.g.

    sys.modules['reportStore'] = sys.modules['fathom.reportStore']


Someout suggested to use an XML export, then change all class
references with a text editor and import it again.
You will loose all history information and information
about the last modification time (this will become the import time).

-- 
Dieter



More information about the ZODB-Dev mailing list