Alek Kowalczyk <[EMAIL PROTECTED]> writes:

> Hi,
> I moved my content class from mypackage.mymodule.MyContentClass into
> mypackage.mysubpackage.mymodule.MyContentClass.
> But when started Zope and went to visit an object I have previously created 
> (of
> MyContentClass), I get:
> ComponentLookupError: ((<persistent broken mypackage.mymodule.MyContentClass
> instance '\x00\x00\x00\x00\x00\x00\x02q'>,
> <zope.publisher.browser.BrowserRequest instance
<at>  <at> index.html>),
> <InterfaceClass zope.interface.Interface>, 'index.html')
> I'm already familiar with generations - I've done two up to now. I guess I
> should somehow evolve the ZoDB to 'rename'
> But I don't know how to do that?

I found a quite well working solution on

There was only one issue: this solution assumes that we have given a DB, while
Zope evolve method receives already open connection. Unfortunately classFactory
from DB is cached in Connection's private fields in constructor.
Because of that I could not assign my custom 'renaming' class factory using:

def evolve(context): #won't work!
    context.connection.db().classFactory = myClassFactory 

Instead I had to do some dirty private fields substitution in Connection's

def evolve(context): #this works nice
    context.connection._reader._factory = myClassFactory

Zope3-users mailing list

Reply via email to