On 6/12/07, Rupert Redington <[EMAIL PROTECTED]> wrote:

Aleksander Kowalczyk wrote:
> On 6/8/07, Alek Kowalczyk <[EMAIL PROTECTED]> wrote:
>> 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
> I found a quite well working solution on
>> http://mail.zope.org/pipermail/zodb-dev/2006-September/010382.html
>> [...]
> I shouldn't announce success too early. The solution works but only
> first Zope run (i.e just after evolving the schema).
> Although classFactory returns proper class during evolve, the new class
> name
> is not saved in ZoDB, so after next unghosting object get old class
> again.
> Here is my evolve script. I really don't know what more should I do to
> Zope/ZoDB write the new class name in ZoDB. Can someone help me a bit...

Somebody correct me if I'm wrong
I imagine you'd need to commit the transaction manually:

def evolve(context):
    #dirty hack to substitute classFactory
    context.connection._reader._factory = convertingClassFactory
    root = context.connection.root().get(ZopePublication.root_name, None)
    for object in findObjectsMatching(root, lambda x: True):
         if hasattr(object, '_p_activate'):
            object._p_changed = True
    import transaction

Hope that helps,


Yes, I've tried this already - it doesn't work too :(
I have removed this because I believe Zope.generations do the commit for me
after calling my evolve function.

Alek Kowalczyk
Zope3-users mailing list

Reply via email to