On 6/12/07, <b class="gmail_sendername">Rupert Redington</b> <<a href="mailto:rupert@neontribe.co.uk">rupert@neontribe.co.uk</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Aleksander Kowalczyk wrote:<br>> On 6/8/07, Alek Kowalczyk <<a href="mailto:thealx@poczta.onet.pl">thealx@poczta.onet.pl</a>> wrote:<br>>><br>>> Alek Kowalczyk <thealx@...> writes:<br>>><br>
>> ><br>>> > Hi,<br>>> > I moved my content class from mypackage.mymodule.MyContentClass into<br>>> > mypackage.mysubpackage.mymodule.MyContentClass.<br>>> > But when started Zope and went to visit an object I have previously
<br>>> created (of<br>>> > MyContentClass), I get:<br>>> > ComponentLookupError: ((<persistent broken<br>>> mypackage.mymodule.MyContentClass<br>>> > instance '\x00\x00\x00\x00\x00\x00\x02q'>,
<br>>> > <zope.publisher.browser.BrowserRequest instance<br>>><br>> I found a quite well working solution on<br>>> <a href="http://mail.zope.org/pipermail/zodb-dev/2006-September/010382.html">http://mail.zope.org/pipermail/zodb-dev/2006-September/010382.html
</a><br>>> [...]<br>> I shouldn't announce success too early. The solution works but only during<br>> first Zope run (i.e just after evolving the schema).<br>> Although classFactory returns proper class during evolve, the new class
<br>> name<br>> is not saved in ZoDB, so after next unghosting object get old class names<br>> again.<br>><br>> Here is my evolve script. I really don't know what more should I do to make<br>> Zope/ZoDB write the new class name in ZoDB. Can someone help me a bit... :)
<br>><br><br>Somebody correct me if I'm wrong<br>I imagine you'd need to commit the transaction manually:<br><br><br> def evolve(context):<br> #dirty hack to substitute classFactory<br> context.connection._reader._factory
= convertingClassFactory<br> root = context.connection.root().get(ZopePublication.root_name, None)<br> for object in findObjectsMatching(root, lambda x: True):<br> if hasattr(object, '_p_activate'):
<br> object._p_activate()<br> object._p_changed = True<br> import transaction<br> transaction.commit()<br><br><br>Hope that helps,<br><br>Rupert<br></blockquote></div><br>Yes, I've tried this already - it doesn't work too :(
<br>I have removed this because I believe Zope.generations do the commit for me after calling my evolve function. <br><br><br clear="all">Thanks!<br>Alek Kowalczyk<br>