On 6/12/07, <b class="gmail_sendername">Rupert Redington</b> &lt;<a href="mailto:rupert@neontribe.co.uk">rupert@neontribe.co.uk</a>&gt; 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>&gt; On 6/8/07, Alek Kowalczyk &lt;<a href="mailto:thealx@poczta.onet.pl">thealx@poczta.onet.pl</a>&gt; wrote:<br>&gt;&gt;<br>&gt;&gt; Alek Kowalczyk &lt;thealx@...&gt; writes:<br>&gt;&gt;<br>
&gt;&gt; &gt;<br>&gt;&gt; &gt; Hi,<br>&gt;&gt; &gt; I moved my content class from mypackage.mymodule.MyContentClass into<br>&gt;&gt; &gt; mypackage.mysubpackage.mymodule.MyContentClass.<br>&gt;&gt; &gt; But when started Zope and went to visit an object I have previously
<br>&gt;&gt; created (of<br>&gt;&gt; &gt; MyContentClass), I get:<br>&gt;&gt; &gt; ComponentLookupError: ((&lt;persistent broken<br>&gt;&gt; mypackage.mymodule.MyContentClass<br>&gt;&gt; &gt; instance &#39;\x00\x00\x00\x00\x00\x00\x02q&#39;&gt;,
<br>&gt;&gt; &gt; &lt;zope.publisher.browser.BrowserRequest instance<br>&gt;&gt;<br>&gt; I found a quite well working solution on<br>&gt;&gt; <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>&gt;&gt; [...]<br>&gt; I shouldn&#39;t announce success too early. The solution works but only during<br>&gt; first Zope run (i.e just after evolving the schema).<br>&gt; Although classFactory returns proper class during evolve, the new class
<br>&gt; name<br>&gt; is not saved in ZoDB, so after next unghosting object get old class names<br>&gt; again.<br>&gt;<br>&gt; Here is my evolve script. I really don&#39;t know what more should I do to make<br>&gt; Zope/ZoDB write the new class name in ZoDB. Can someone help me a bit... :)
<br>&gt;<br><br>Somebody correct me if I&#39;m wrong<br>I imagine you&#39;d need to commit the transaction manually:<br><br><br> def evolve(context):<br>&nbsp;&nbsp;&nbsp;&nbsp;#dirty hack to substitute classFactory<br>&nbsp;&nbsp;&nbsp;&nbsp;context.connection._reader._factory
 = convertingClassFactory<br>&nbsp;&nbsp;&nbsp;&nbsp;root = context.connection.root().get(ZopePublication.root_name, None)<br>&nbsp;&nbsp;&nbsp;&nbsp;for object in findObjectsMatching(root, lambda x: True):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if hasattr(object, &#39;_p_activate&#39;):
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;object._p_activate()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;object._p_changed = True<br>&nbsp;&nbsp;&nbsp;&nbsp;import transaction<br>&nbsp;&nbsp;&nbsp;&nbsp;transaction.commit()<br><br><br>Hope that helps,<br><br>Rupert<br></blockquote></div><br>Yes, I&#39;ve tried this already - it doesn&#39;t work too :(&nbsp; 
<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>