[Zope-dev] more persistent mapping misery

Dieter Maurer dieter at handshake.de
Thu Jan 1 14:16:45 EST 2004


Chris McDonough wrote at 2003-12-30 20:13 -0500:
>On the HEAD recently, a bunch of changes were made to the Persistence
>package.  Notably, the Persistence.PersistentMapping module was removed
>in favor of a Persistence.mapping module.  Unfortunately, there are
>instance pickles lying around in any CMF instance created prior to the
>changes (DiscussionItem's _container attribute is the one I found) which
>explicitly refer to Persistence.PersistentMapping.PersistentMapping. 
>This name can no longer be resolved to a class.  This breaks b/w
>compatibility.
>
>I "fixed" the issue by adding the following to the Persistence package's
>__init__.py:
>
>sys.modules['Persistence.PersistentMapping'] =
>sys.modules['Persistence.mapping']
>
>That seems really ugly, though.  Is there a better way to fix it?

There is also the "__module_aliases__" directive in
product initialization code. It is used (e.g.) for
"PythonScripts".

It does things very similar to what you did (it is slightly more
careful as it does not override an existing module)
but it is nice to stick to a single way to solve such
problems.

-- 
Dieter



More information about the Zope-Dev mailing list