Return of Zoo guestbook problem.
Hello all, I'm trying to tackle the Zoo GuestBook example from the Zope book: http://www.zope.org/Members/michel/ZB/SimpleExamples.dtml I've got it all working except the last part in the AddEntry python script. I now have Zope 2.3.1 installed on my ISP's system. The script craters on the first line which reads: """ Create a guest book entry. """ # create a unique document id id='entry_%d' % len(context.objectIds()) With the following error message: Zope Error Zope has encountered an error while publishing this resource. Error Type: NameError Error Value: context Troubleshooting Suggestions This resource may be trying to reference a nonexistent object or variable context. The URL may be incorrect. The parameters passed to this resource may be incorrect. A resource that this resource relies on may be encountering an error. For more detailed information about the error, please refer to the HTML source for this page. If the error persists please contact the site maintainer. Thank you for your patience. Traceback (innermost last): File /home/zope/zope5/lib/python/ZPublisher/Publish.py, line 223, in publish_module File /home/zope/zope5/lib/python/ZPublisher/Publish.py, line 187, in publish File /home/zope/zope5/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook (Object: Traversable) File /home/zope/zope5/lib/python/ZPublisher/Publish.py, line 171, in publish File /home/zope/zope5/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: addEntryAction) File /home/zope/zope5/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: addEntryAction) File /home/zope/zope5/lib/python/OFS/DTMLMethod.py, line 189, in __call__ (Object: addEntryAction) File /home/zope/zope5/lib/python/DocumentTemplate/DT_String.py, line 538, in __call__ (Object: addEntryAction) File /home/zope/zope5/lib/python/DocumentTemplate/DT_Util.py, line 334, in eval (Object: addEntry(guest_name, comments)) (Info: guest_name) File <string>, line 0, in ? File /home/zope/zope5/lib/python/Products/PythonMethod/PythonMethod.py, line 168, in __call__ (Object: addEntry) (Info: (('Anonymous', ''), {}, None)) File <string>, line 6, in addEntry NameError: (see above)
Hi Ignacio, replace the quotation mark comments ["""] surrounding line 1: 'Create a guest book entry' with a simple hash [#] comment preceding it.. .....or just delete the whole comment! It is those quotation marks the compiler doesn't like cheers Sandy Ignacio Valdes wrote:
Hello all,
I'm trying to tackle the Zoo GuestBook example from the Zope book: http://www.zope.org/Members/michel/ZB/SimpleExamples.dtml
I've got it all working except the last part in the AddEntry python script. I now have Zope 2.3.1 installed on my ISP's system. The script craters on the first line which reads:
""" Create a guest book entry. """ # create a unique document id id='entry_%d' % len(context.objectIds())
Thanks Sandy, Deleted the """ comments, same result: Zope Error Zope has encountered an error while publishing this resource. Error Type: NameError Error Value: context Troubleshooting Suggestions This resource may be trying to reference a nonexistent object or variable context. The URL may be incorrect. The parameters passed to this resource may be incorrect. A resource that this resource relies on may be encountering an error. For more detailed information about the error, please refer to the HTML source for this page. If the error persists please contact the site maintainer. Thank you for your patience. Traceback (innermost last): File /home/zope/zope5/lib/python/ZPublisher/Publish.py, line 223, in publish_module File /home/zope/zope5/lib/python/ZPublisher/Publish.py, line 187, in publish File /home/zope/zope5/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook (Object: Traversable) File /home/zope/zope5/lib/python/ZPublisher/Publish.py, line 171, in publish File /home/zope/zope5/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: addEntryAction) File /home/zope/zope5/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: addEntryAction) File /home/zope/zope5/lib/python/OFS/DTMLMethod.py, line 189, in __call__ (Object: addEntryAction) File /home/zope/zope5/lib/python/DocumentTemplate/DT_String.py, line 538, in __call__ (Object: addEntryAction) File /home/zope/zope5/lib/python/DocumentTemplate/DT_Util.py, line 334, in eval (Object: addEntry(guest_name, comments)) (Info: guest_name) File <string>, line 0, in ? File /home/zope/zope5/lib/python/Products/PythonMethod/PythonMethod.py, line 168, in __call__ (Object: addEntry) (Info: (('Anonymous', 'test'), {}, None)) File <string>, line 3, in addEntry NameError: (see above) Sandy Britain wrote:
Hi Ignacio,
replace the quotation mark comments ["""] surrounding line 1: 'Create a guest book entry' with a simple hash [#] comment preceding it..
.....or just delete the whole comment! It is those quotation marks the compiler doesn't like
cheers Sandy
Ignacio Valdes wrote:
Hello all,
I'm trying to tackle the Zoo GuestBook example from the Zope book: http://www.zope.org/Members/michel/ZB/SimpleExamples.dtml
I've got it all working except the last part in the AddEntry python script. I now have Zope 2.3.1 installed on my ISP's system. The script craters on the first line which reads:
""" Create a guest book entry. """ # create a unique document id id='entry_%d' % len(context.objectIds())
On Mon, 9 Apr 2001, Ignacio Valdes wrote:
Thanks Sandy, Deleted the """ comments, same result:
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: NameError Error Value: context
Are you sure when you were playing around you didn't accidentally remove the 'context' binding from the Bindings view of the script? In general, those things should not be changed. Make sure that the value 'context' is in the Context box of the Bindings view. -Michel
Michel Pelletier wrote:
On Mon, 9 Apr 2001, Ignacio Valdes wrote:
Thanks Sandy, Deleted the """ comments, same result:
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: NameError Error Value: context
Are you sure when you were playing around you didn't accidentally remove the 'context' binding from the Bindings view of the script? In general, those things should not be changed. Make sure that the value 'context' is in the Context box of the Bindings view.
-Michel
Err, don't know what this is or how to get to it, so I'm pretty sure I didn't change it. I don't see a Bindings view with a quick check. -- IV
On Mon, 9 Apr 2001, Sandy Britain wrote:
Hi Ignacio,
replace the quotation mark comments ["""] surrounding line 1: 'Create a guest book entry' with a simple hash [#] comment preceding it..
.....or just delete the whole comment! It is those quotation marks the compiler doesn't like
The comments work just fine here. -Michel
Ignacio Valdes wrote:
/home/zope/zope5/lib/python/Products/PythonMethod/PythonMethod.py, line
Urm... your problem is that you're using the wrong product. Python Methods, AFAIK, don't work like that demo needs. You want Python SCRIPTS as bundled with Zope 2.3.0+ It appears in the add list as 'Script (Python)' cheers, Chris (who would never say 'told you so' about the naming problem with scripts, oh no... ;-)
That's IT!!! -- IV Chris Withers wrote:
Ignacio Valdes wrote:
/home/zope/zope5/lib/python/Products/PythonMethod/PythonMethod.py, line
Urm... your problem is that you're using the wrong product. Python Methods, AFAIK, don't work like that demo needs.
You want Python SCRIPTS as bundled with Zope 2.3.0+
It appears in the add list as 'Script (Python)'
cheers,
Chris (who would never say 'told you so' about the naming problem with scripts, oh no... ;-)
Hi, I have a difficulty with using the ZMySQLDA, the MySQL python extension (latest version), MySQL's current version, Zope 2.3.1 with Python 2.0 on Solaris 8 for Intel x86. Queries involving a SELECT to the DB all fail with "AttributeError: rollback" -- this happens whether or not the tables are capable of doing rollbacks -- and the database connection always reports "Transactions are disabled". Worse, when I try the query "show tables" or "describe <dbname>", Python dumps core, having received a signal 9, SIGKILL. Apart from this, the system seems very stable indeed. I don't understand what's going on. Everything was compiled today, using gcc-2.95.3 and the Sun-supplied versions of the binary utilities. I've compiled this lot on Intel x86 / Linux without trouble, though haven't tested the MySQL connections on such a platform. Could anyone give a pointer as to how to debug this please? Thank you, John Warburton -- http://johnwarburton.net/
participants (5)
-
Chris Withers -
Ignacio Valdes -
John Warburton -
Michel Pelletier -
Sandy Britain