[Zope] Passing parameters from python to dtml objects..

Shane O'Sullivan shane.osullivan@engitech.ie
Wed, 31 Oct 2001 14:26:58 -0000


This is a multi-part message in MIME format.

------=_NextPart_000_002D_01C16218.196B8AE0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

hi all,
        I am currently working on a python script that is called from a =
dtml method. It performs some logic and then calls another dtml method. =
I am passing 2 parameters into the python script, "hidden_photo" and =
"photo_name"..my python script looks like this...

if photo_name =3D=3D ' ':
   if hidden_photo =3D=3D ' ':
      return context.scReport(context)
   elif hidden_photo =3D=3D 'None':
      return context.scReport(context)
   else:
      return context.Thumbnails.deletePhoto(context)
      return context.scReport(context)
elif photo_name =3D=3D'None':
     return context.scReport(context)
else:
     return context.Thumbnails.photoAction(context)
     return context.scReport(context)

The methods photoAction and deletePhoto need to be passed the parameters =
"hidden_photo" and "photo_name" - however it dosn't seem to be getting =
them properly- this is the error message
Error Type: NameError
Error Value: global name 'photo_name' is not defined

Can anyone tell me how properly to pass parameters from python to dtml =
objects?

Thanks in advance,
Shane


------=_NextPart_000_002D_01C16218.196B8AE0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>hi all,</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I am=20
currently working on a python script that is called from a&nbsp;dtml =
method. It=20
performs some logic and then calls another dtml method. I am passing 2=20
parameters into the python script, "hidden_photo" and "photo_name"..my =
python=20
script looks like this...</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>if photo_name =3D=3D ' =
':<BR>&nbsp;&nbsp; if=20
hidden_photo =3D=3D ' ':<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return=20
context.scReport(context)<BR>&nbsp;&nbsp; elif hidden_photo =3D=3D=20
'None':<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return=20
context.scReport(context)<BR>&nbsp;&nbsp;=20
else:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return=20
context.Thumbnails.deletePhoto(context)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 return=20
context.scReport(context)<BR>elif photo_name=20
=3D=3D'None':<BR>&nbsp;&nbsp;&nbsp;&nbsp; return=20
context.scReport(context)<BR>else:<BR>&nbsp;&nbsp;&nbsp;&nbsp; return=20
context.Thumbnails.photoAction(context)<BR>&nbsp;&nbsp;&nbsp;&nbsp; =
return=20
context.scReport(context)<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>The methods photoAction and deletePhoto =
need to be=20
passed the parameters "hidden_photo" and "photo_name" - however it =
dosn't seem=20
to be getting them properly- this is the error message</FONT><FONT =
face=3DArial=20
size=3D2><STRONG></STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>Error Type:=20
NameError</STRONG><BR><STRONG>Error Value: global name 'photo_name' is =
not=20
defined</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Can anyone tell me how properly to pass =
parameters=20
from python to dtml objects?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks in advance,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Shane<BR></DIV></FONT></BODY></HTML>

------=_NextPart_000_002D_01C16218.196B8AE0--