[Zope] Runtime error in python scripts
Harris Peter
PHarris@JimBeam.co.uk
Thu, 4 Oct 2001 09:27:53 +0100
Hi
I just got a query from someone testing my Zope application "f2w helpdesk"
(on sourceforge).
They got an error in a Python Script:
Error Type: RuntimeError
Error Value: Script (Python) task_originator_phone has errors.
with the following traceback:
--------------------------------------------
Traceback (innermost last):
File /usr/lib/python2.1/site-packages/ZPublisher/Publish.py, line 223, in
publish_module
[snip... the usual stuff ]
(Object: edit_open_request)
File /usr/lib/python2.1/site-packages/DocumentTemplate/DT_Util.py, line
231,
in eval
(Object: task_originator_phone(r_originator))
(Info: task_originator_phone)
File <string>, line 2, in f
File /usr/share/zope/lib/python/Shared/DC/Scripts/Bindings.py, line 324,
in
__call__
(Object: task_originator_phone)
File /usr/share/zope/lib/python/Shared/DC/Scripts/Bindings.py, line 354,
in
_bindAndExec
(Object: task_originator_phone)
File /usr/share/zope/lib/python/Products/PythonScripts/PythonScript.py,
line
354, in _exec
(Object: task_originator_phone)
(Info: ({'script': <PythonScript instance at 88b7548>, 'context':
<r instance at 88ce2f0>, 'container': <Folder instance at 8829200>,
'traverse_subpath': []}, ('OPSC',), {}, ()))
RuntimeError: (see above)
----------------------------------
They are clearly using Python 2.1, and hence Zope 2.4. I am using Zope
2.3.3 on
Debian, and I can't duplicate the error myself.
What I am asking is, have there been any incompatible changes between Zope
2.3 and
Zope 2.4 in the syntax or handling of Python scripts?
The script is as follows, in case it gives any clues.
## Script (Python) "task_originator_phone"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=r_originator
##title=
##
results = context.sel_k_1(k_id=r_originator)
contact = results and results[0] # None if no results, first row if there
are any
visible = "" # The text to appear on the page
title = "" # The title text (hover help, on some Browsers)
if contact:
if contact.k_ext:
visible = contact.k_ext + " " + contact.k_location # Prefer ext and
location
title = contact.k_phone_1 or contact.k_phone_2 # help is a phone
number
else:
visible = contact.k_phone_1 or contact.k_phone_2 # settle for a
phone number
if visible:
return '%s' % (title,visible)
else:
return ""
----------
I will be grateful for any clues as to what I can do to make my scripts
compatible with
both versions of Zope, if that is indeed the problem.
If the problem is I've done something stupid, please someone let me know
about that too :)
Peter Harris
****************************************************************************
This message and any files transmitted with it are confidential.
The contents may not be disclosed or used by anyone other
than the addressee.
If you have received this communication in error, please delete
the message and notify JBB (Greater Europe) Plc immediately
on 0141-248-5771.
The views expressed in this email are not necessarily the views
of JBB (Greater Europe) PLC.
As it has been transmitted over a public network,
JBB (Greater Europe) PLC makes no representation nor accepts
any liability for the email's accuracy or completeness unless
expressly stated to the contrary.
Should you, as the intended recipient, suspect that the message
has been intercepted or amended, please notify
JBB (Greater Europe) Plc immediately on 0141-248-5771.
****************************************************************************