Re: ZClass Bug (was: Re: [Zope] How to access id and title of document calling standard_html_header)
----- Original Message ----- From: "Dieter Maurer" <dieter@handshake.de> To: "Tim Hicks" <tim@sitefusion.co.uk> Sent: Thursday, September 07, 2000 7:00 PM Subject: Re: ZClass Bug (was: Re: [Zope] How to access id and title of document calling standard_html_header)
Hi Tim
NameError: theatre_class
It would seem that <string> is still raising its head. Any ideas? I do not think so. You get a name error: Zope does not know your "theatre_class" at this point.
It seems more likely, that DC changed to way ZClasses are located inside the constructor.
Take the generated ZClass constructor and simply add the "...REQUEST.set..." before the "createInObjectManager".
OK, I'm so sorry about this, you've been an absolute legend so far, and I really don't want to push my luck, but each time you solve something, I find something else that has broken. This is what my theatre_class_add method looks like (well, an excerpt anyway). <dtml-call "REQUEST.set('__name__', REQUEST['id'])"> <dtml-with "theatre_class.createInObjectManager(REQUEST['id'], REQUEST)"> <dtml-call "propertysheets.theatre_class_property.manage_editProperties(REQUEST)"
<dtml-call "manage_edit('<dtml-var standard_html_header>\n\n<dtml-var standard_html_footer>', '')"> </dtml-with> When I try to create a new instance of the zclass in the original 'site' folder (or any of its parent folders except for the root), I get this error. I do not receive an error and everything works fine when I create the instance in a new folder on a different 'branch' to the original. <traceback> Traceback (innermost last): File C:\PROGRA~1\Zope221\lib\python\ZPublisher\Publish.py, line 222, in publish_module File C:\PROGRA~1\Zope221\lib\python\ZPublisher\Publish.py, line 187, in publish (Object: testing) File C:\PROGRA~1\Zope221\lib\python\Zope\__init__.py, line 221, in zpublisher_exception_hook (Object: RoleManager) File C:\PROGRA~1\Zope221\lib\python\ZPublisher\Publish.py, line 171, in publish (Object: testing) File C:\PROGRA~1\Zope221\lib\python\ZPublisher\mapply.py, line 160, in mapply (Object: theatre_class_add) File C:\PROGRA~1\Zope221\lib\python\ZPublisher\Publish.py, line 112, in call_object (Object: theatre_class_add) File C:\PROGRA~1\Zope221\lib\python\OFS\DTMLMethod.py, line 172, in __call__ (Object: theatre_class_add) File C:\PROGRA~1\Zope221\lib\python\DocumentTemplate\DT_String.py, line 528, in __call__ (Object: theatre_class_add) File C:\PROGRA~1\Zope221\lib\python\DocumentTemplate\DT_With.py, line 133, in render (Object: theatre_class.createInObjectManager(REQUEST['id'], REQUEST)) File C:\PROGRA~1\Zope221\lib\python\DocumentTemplate\DT_Util.py, line 337, in eval (Object: theatre_class.createInObjectManager(REQUEST['id'], REQUEST)) (Info: REQUEST) File <string>, line 0, in ? NameError: theatre_class </traceback> When I try to copy and paste a zclass from this original 'site' folder (or any of its parent folders except for the root), I get this error. I do not receive an error and everything works fine when I copy and paste an instance in a new folder on a different 'branch' to the original. "One or more items referred to in the clipboard data was not found. The item may have been moved or deleted after you copied it." When I try to rename a class that is in the original 'site' folder (or any of its parent folders except for the root), I get this error. I do not receive an error and everything works fine when I rename an instance in a new folder on a different 'branch' to the original. <traceback> Traceback (innermost last): File C:\PROGRA~1\Zope221\lib\python\ZPublisher\Publish.py, line 222, in publish_module File C:\PROGRA~1\Zope221\lib\python\ZPublisher\Publish.py, line 187, in publish File C:\PROGRA~1\Zope221\lib\python\Zope\__init__.py, line 221, in zpublisher_exception_hook (Object: Traversable) File C:\PROGRA~1\Zope221\lib\python\ZPublisher\Publish.py, line 171, in publish File C:\PROGRA~1\Zope221\lib\python\ZPublisher\mapply.py, line 160, in mapply (Object: manage_renameObjects) File C:\PROGRA~1\Zope221\lib\python\ZPublisher\Publish.py, line 112, in call_object (Object: manage_renameObjects) File C:\PROGRA~1\Zope221\lib\python\OFS\CopySupport.py, line 273, in manage_renameObjects (Object: Traversable) File C:\PROGRA~1\Zope221\lib\python\OFS\CopySupport.py, line 285, in manage_renameObject (Object: Traversable) File C:\PROGRA~1\Zope221\lib\python\OFS\ObjectManager.py, line 236, in _getOb (Object: Traversable) AttributeError: (see above) </traceback> Like I say, you've been fantastic in helping me. Thanks to you, I now have a solution whereby I know I can redo all of the class instances I have created, and be sure that the error won't reappear. However, I'm sure from what you have said so far, there is a way around this that doesn't involve me 'writing off' all the instances that I have already created. My problem is, I'm a little out of my depth here! I don't understand the different behaviour between different folders. If you haven't already got tired of this, thanks very much. tim
Hi Tim, Tim Hicks writes:
.... The "theatre_class" ZClass constructor "theatre_class_add" raises a NameError "theatre_class" in <dtml-with "theatre_class.createInObjectManager(REQUEST['id'], REQUEST)"> if called in some folders but not in other folders ....
When I try to copy and paste a zclass in these folders, I get the error ... "One or more items referred to in the clipboard data was not found. The item may have been moved or deleted after you copied it." ... In the other folders, everything is fine ....
When I try to rename a class in these folders, it raises an AttributeError in "ObjectManager(236)._getOb", Object "Traversable". ... In the other folders, everything is fine ....
I tried to reproduce the behavior in my vanilla Zope 2.2.1. Not only, I was unable to do that (as I expected). I was also unable to reproduce your original "id" problem! Zope 2.2.1 apparently no longer has the bug, I analysed for Zope 2.1.6. Did you do your 2.2.1 check by exporting your site from 2.1.6 and importing it into Zope 2.2.1? If so, then probably Zope 2.2.1 is very confused by the strange Zope 2.1.6 ZClasses. Please rebuild your "theatre_class" ZClass from scratch in Zope 2.2.1 (at the same place, it is in Zope 2.1.6!). Create an instance and check whether the id bug is still present -- as I said, I do no longer see this bug. If the bug is no longer there, give your ZInstances Id's in Zope 2.1.6 (by renaming). Then export them and reimport into Zope 2.2.1 (you may try with a single one; if it works do it with all). If you still see this strange folder dependent behavior, then, you may have lost parts of your site. Maybe, DC can help you in this case as sites exported from 2.1.6 should be importable into 2.2.1. I will not analyse such an export/import problem (unless I get myself hit). If you *rebuild* your ZInstances *from scratch* in 2.2.1 (start with a few) and you continue to see the strange folder dependent behavior, you may contact me again. Obviously, such a thing should not happen. Dieter
participants (2)
-
Dieter Maurer -
Tim Hicks