Simple Example problem: ZooExhibit ZClass
I am trying to create a simple ZClass as per Chapter 12 of _The Zope Book_. I can create the ZClass, but I cannot add one to my folders. When I go to the root folder and select "Zoo Exhibit" from the "Select type to add..." list, it asks for the id. (So my auto-generated ZooExhibit_addForm DTML Method is working.) But when I click on the "Add" button, thus [theoretically] invoking the auto-generated ZooExhibit_add DTML Method, I get the following "Site Error" page displayed to me as simple text -- that is, the HTML is not rendered by my browser, I actually see the raw HTML code in my right-side browser frame: --------------------------------------------------------- <TABLE BORDER="0" WIDTH="100%"> <TR VALIGN="TOP"> <TD WIDTH="10%" ALIGN="CENTER"> </TD> <TD WIDTH="90%"> <H2>Site Error</H2> <P>An error was encountered while publishing this resource. </P> <P><STRONG>NameError</STRONG></P> Sorry, a site error occurred.<p> <!-- Traceback (innermost last): File /usr/lib/python2.1/site-packages/ZPublisher/Publish.py, line 223, in publish_module File /usr/share/zope/lib/python/Products/Localizer/__init__.py, line 53, in new_publish File /usr/lib/python2.1/site-packages/ZPublisher/Publish.py, line 187, in publish File /usr/share/zope/lib/python/Zope/__init__.py, line 226, in zpublisher_exception_hook (Object: ZooExhibit_factory) File /usr/lib/python2.1/site-packages/ZPublisher/Publish.py, line 171, in publish File /usr/lib/python2.1/site-packages/ZPublisher/mapply.py, line 160, in mapply (Object: ZooExhibit_add) File /usr/lib/python2.1/site-packages/ZPublisher/Publish.py, line 112, in call_object (Object: ZooExhibit_add) File /usr/share/zope/lib/python/OFS/DTMLMethod.py, line 199, in __call__ (Object: ZooExhibit_add) File /usr/lib/python2.1/site-packages/DocumentTemplate/DT_String.py, line 546, in __call__ (Object: ZooExhibit_add) File /usr/lib/python2.1/site-packages/DocumentTemplate/DT_With.py, line 133, in render (Object: ZooExhibit.createInObjectManager(REQUEST['id'], REQUEST)) File /usr/lib/python2.1/site-packages/DocumentTemplate/DT_Util.py, line 231, in eval (Object: ZooExhibit.createInObjectManager(REQUEST['id'], REQUEST)) (Info: REQUEST) File <string>, line 2, in f (Object: guarded_getitem) NameError: global name 'ZooExhibit' is not defined --> <HR NOSHADE> <P>Troubleshooting Suggestions</P> <UL> <LI>The URL may be incorrect.</LI> <LI>The parameters passed to this resource may be incorrect.</LI> <LI>A resource that this resource relies on may be encountering an error.</LI> </UL> <P>For more detailed information about the error, please refer to the HTML source for this page. </P> <P>If the error persists please contact the site maintainer. Thank you for your patience. </P> </TD></TR> </TABLE> --------------------------------------------------------- Notice the NameError: global name 'ZooExhibit' is not defined I don't know what this means or why it's not working. I believe I have followed the instructions in the tutorial exactly. It's not a permissions thing because I have tried both (a) giving the Manager account the ability to "Add Zoo Exhibit", and (b) changing the "ZooExhibit_factory" permission to be "Add Documents, Images, and Files", with no change in behavior. I would be very grateful if somebody could advise me on how to troubleshoot this problem. Here is my system info: [dereks@dereks dereks]$ rpm -qa | grep -i zope Zope-zserver-2.4.3-1 Zope-2.4.3-1 [dereks@dereks dereks]$ cat /etc/mandrake-release Mandrake Linux release 8.1 (Vitamin) for i586 [dereks@dereks dereks]$ rpm -q python python-devel python-2.1.1-3mdk python-devel-2.1.1-3mdk Thank You, Derek Simkowiak
Derek Simkowiak writes:
When I go to the root folder and select "Zoo Exhibit" from the "Select type to add..." list, it asks for the id. (So my auto-generated ZooExhibit_addForm DTML Method is working.)
But when I click on the "Add" button, thus [theoretically] invoking the auto-generated ZooExhibit_add DTML Method, I get the following "Site Error" page displayed to me as simple text -- that is, the HTML is not rendered by my browser, I actually see the raw HTML code in my right-side browser frame: Try to export the content of your folder, make a TGZ or ZIP archive and send it to me.
Dieter
-> > following "Site Error" page displayed to me as simple text -- that is, the -> > HTML is not rendered by my browser, I actually see the raw HTML code in my -> > right-side browser frame: -> Try to export the content of your folder, make a TGZ or ZIP archive -> and send it to me. I'll be sending the Product (the ZooExhibit example from Chapter 12 of _The Zope Book_) and a .zexp of just an empty folder (where I have tried, and failed, to add a "Zoo Exhibit" instance) to Dieter privately within the next couple of hours. If anyone else is interested in looking at it, please email me privately so I can send it to you. And Dieter: Thanks for your help. --Derek
-> > When I go to the root folder and select "Zoo Exhibit" from the -> > "Select type to add..." list, it asks for the id. (So my auto-generated -> > ZooExhibit_addForm DTML Method is working.) -> > -> > But when I click on the "Add" button, thus [theoretically] -> > invoking the auto-generated ZooExhibit_add DTML Method, I get the -> > following "Site Error" page displayed to me as simple text -- that is, the -> > HTML is not rendered by my browser, I actually see the raw HTML code in my -> > right-side browser frame: -> Try to export the content of your folder, make a TGZ or ZIP archive -> and send it to me. Dieter & Company, I rebooted my Linux box (in order to send the .zexp and .tgz to Dieter), and now my "Zoo Exhibit" product is completely gone from the Product list. I have re-created it from scratch, and I am now NOT having any problems. I believe I corrupted the "Products" database somehow. Here is what I *remember* doing (i.e., take with a grain of salt): 1. Add the new Product with id "ZooExhibit" 2. Add a Factory (called myFactory), and a simple addForm() DTML method (again, this is all as per Chapter 12 of _The Zope Book_) 3. Now DELETE that "ZooExhibit" product. At this point, I probably should have restarted Zope, but I did not. Perhaps that is what caused my error, although I saw nothing in the docs indicating that a Zope restart is necessary after adding/removing products. 4. Now Add a new product with id "ZooExhibit" (NOTE: Same id as before!) 5. Add a ZClass called "ZooExhibit" to that Product 6. Go to a regular folder and try to add a "Zoo Exhibit". That is where my error occured yesterday. I don't have time right now to try to repro my problem... if I get around to it later, I will try to repro and see if this should be reported as a "bug". If somebody else has time, please try the above steps to see if you get my error. If this turns out to not be reproducable, I guess we'll just attribute it to my pre-2.4.4 version of Zope: [dereks@dereks dereks]$ rpm -q Zope Zope-zserver Zope-2.4.3-1 Zope-zserver-2.4.3-1 Thanks, Derek
participants (2)
-
Derek Simkowiak -
Dieter Maurer