Re: [Zope] ZClasses meet PythonScripts, sample request
Hi, Tim What is the name of the propertysheet in your ZClass that these values are on? Is it 'job_info'? Where is the editFormAction Python Script? It should be in your ZClass's /methods. If you are instead acquiring it from a Folder somewhere, you will need to use 'context' instead of 'container' inside the Python Script. -- Jim Washington Timothy Wilson wrote:
On Mon, 15 Jan 2001, Jim Washington wrote:
I have it. The Python Script I sent you:
container.propertysheets['job_info'].manage_changeProperties(REQUEST)
needs to be rewritten:
container.propertysheets.job_info.manage_changeProperties(REQUEST)
Hey Jim,
I'm getting closer. Now I get the following error and traceback:
Error Type: AttributeError Error Value: job_info
Traceback (innermost last): File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/Publish.py, line 222, in publish_module File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/Publish.py, line 187, in publish File /var/lib/zope/2.3.0a2/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook (Object: Traversable) File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/Publish.py, line 171, in publish File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: editJobForm) File /var/lib/zope/2.3.0a2/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: editJobForm) File /var/lib/zope/2.3.0a2/lib/python/OFS/DTMLMethod.py, line 189, in __call__ (Object: editJobForm) File /var/lib/zope/2.3.0a2/lib/python/DocumentTemplate/DT_String.py, line 538, in __call__ (Object: editJobForm) File /var/lib/zope/2.3.0a2/lib/python/DocumentTemplate/DT_Util.py, line 336, in eval (Object: editFormAction(REQUEST)) (Info: REQUEST) File <string>, line 0, in ? File /var/lib/zope/2.3.0a2/lib/python/Shared/DC/Scripts/Bindings.py, line 325, in __call__ (Object: editFormAction) File /var/lib/zope/2.3.0a2/lib/python/Shared/DC/Scripts/Bindings.py, line 354, in _bindAndExec (Object: editFormAction) File /var/lib/zope/2.3.0a2/lib/python/Products/PythonScripts/PythonScript.py, line 321, in _exec (Object: editFormAction) (Info: ({'script': <PythonScript instance at 873fbd8>, 'context': <JobPosting instance at 86b7dc0>, 'container': <Folder instance at 87225f0>, 'traverse_subpath': []}, (<h3>form</h3><table><tr valign="top" align="left"><th>posted</th><td>'01/15/2001'</td></tr><tr valign="top" align="left"><th>duties</th><td>['asdfasdf\015\012']</td></tr><tr valign="top" align="left"><th>position</th><td>'asdfadsfasd'</td></tr><tr
-- again snipping the rest of REQUEST --
File Python Script, line 2, in editFormAction File /var/lib/zope/2.3.0a2/lib/python/Products/PythonScripts/Guarded.py, line 272, in __getattr__ File /var/lib/zope/2.3.0a2/lib/python/Products/PythonScripts/Guarded.py, line 143, in __careful_getattr__ (Object: Traversable) AttributeError: (see above)
Any ideas?
On Mon, 15 Jan 2001, Jim Washington wrote:
What is the name of the propertysheet in your ZClass that these values are on? Is it 'job_info'?
Yes.
Where is the editFormAction Python Script? It should be in your ZClass's /methods. If you are instead acquiring it from a Folder somewhere, you will need to use 'context' instead of 'container' inside the Python Script.
I had them originally in the ZClass's /methods, but moved them out. That brings up another good question that I haven't really seen addressed. Hopefully others are still reading this thread. :-) When is it proper to make your methods part of the ZClass itself and when should I put them out in a folder somewhere to be acquired? I've seen it done both ways in various products, but the difference between the two approaches has never been completely clear to me. Can anyone suggest a "rule-of-thumb" here? -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.k12.mn.us/ | http://www.zope.org/ W. St. Paul, MN | | http://slashdot.org/ wilson@visi.com | <dtml-var pithy_quote> | http://linux.com/
participants (2)
-
Jim Washington -
Timothy Wilson