[Zope] How to pass a Z SQL method a variable from a Python Script?
Sage Mo
sagefmo@nc.rr.com
Tue, 14 Jan 2003 13:43:30 -0500
This is a multi-part message in MIME format.
------=_NextPart_000_0005_01C2BBD2.EC796460
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_0006_01C2BBD2.EC796460"
------=_NextPart_001_0006_01C2BBD2.EC796460
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
This is probably a very basic question, but it's been stopping me for =
hours (very frustrating).
I have a Python script that's trying to pass variables into a Z SQL =
method. In the Python script I wrote:
container.send_to_database(CName, email, phone)
where send_to_database is the Z SQL Method.
send_to_database looks like this:
Z SQL Method at /send_to_database Help! =20
Title =20
Connection Id MySQL_database_connection =20
Arguments CName
email
phone
=20
insert into name_table
(CName, email, phone)
values=20
("<dtml-var CName>", "<dtml-var email>", "<dtml-var phone>");
=20
Yet when I run the Python script, I get
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: KeyError
Error Value: CName
Am I passing the variables in the wrong way from the Python =
Script? Is there something wrong with the Z SQL method? In the Python =
script the variables CName, email, phone are well defined. Someone, =
anyone HELP! so I can actually do something besides look hopelessly at =
this error message for days on end.=20
=20
=20
=20
------=_NextPart_001_0006_01C2BBD2.EC796460
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 http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>This is probably a very basic question, =
but it's=20
been stopping me for hours (very frustrating).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I have a Python script that's trying to =
pass=20
variables into a Z SQL method. In the Python script I =
wrote:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>container.send_to_database(CName, =
email,=20
phone)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>where send_to_database is the Z SQL=20
Method.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>send_to_database looks like =
this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><BR>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR class=3Dlocation-bar>
<TD vAlign=3Dtop align=3Dleft>
<DIV class=3Dstd-text><IMG alt=3D"Z SQL Method"=20
src=3D"http://www.heiropure.com/misc_/ZSQLMethods/sqlmethod.gif" =
border=3D0>=20
<STRONG>Z SQL Method at <A=20
=
href=3D"http://www.heiropure.com/manage_workspace"> /</A>send_to_dat=
abase</STRONG></DIV></TD>
<TD vAlign=3Dtop align=3Dright>
<DIV class=3Dstd-text><A=20
onmouseover=3D"window.status=3D'Open online help'; return true;"=20
=
onclick=3D"window.open('http://www.heiropure.com/HelpSys?help_url=3D/Cont=
rol_Panel/Products/ZSQLMethods/Help/Z-SQL-Method_Edit.stx','zope_help','w=
idth=3D600,height=3D500,menubar=3Dyes,toolbar=3Dyes,scrollbars=3Dyes,resi=
zable=3Dyes'); return false;"=20
onmouseout=3D"window.status=3D''; return true;"=20
=
href=3D"http://www.heiropure.com/HelpSys?help_url=3D/Control_Panel/Produc=
ts/ZSQLMethods/Help/Z-SQL-Method_Edit.stx">Help!</A>=20
</DIV></TD></TR></TBODY></TABLE>
<FORM action=3Dmanage_edit method=3Dpost>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR>
<TD vAlign=3Dtop align=3Dleft>
<DIV class=3Dform-optional>Title </DIV></TD>
<TD vAlign=3Dtop align=3Dleft><INPUT size=3D40 name=3Dtitle> =
</TD></TR>
<TR>
<TD vAlign=3Dtop align=3Dleft>
<DIV class=3Dform-label>Connection Id </DIV></TD>
<TD vAlign=3Dtop align=3Dleft>
<DIV class=3Dform-element><SELECT name=3Dconnection_id> <OPTION=20
value=3DMySQL_database_connection=20
selected>MySQL_database_connection</OPTION></SELECT> =
</DIV></TD></TR>
<TR>
<TD vAlign=3Dtop align=3Dleft>
<DIV class=3Dform-optional>Arguments </DIV></TD>
<TD vAlign=3Dtop align=3Dleft><TEXTAREA name=3Darguments rows=3D4 =
cols=3D40>CName
email
phone
</TEXTAREA> </TD></TR>
<TR>
<TD vAlign=3Dtop align=3Dleft colSpan=3D2>
<DIV style=3D"WIDTH: 100%"><TEXTAREA style=3D"WIDTH: 100%" =
name=3Dtemplate:text rows=3D20 wrap=3Doff cols=3D60>insert into =
name_table
(CName, email, phone)
values=20
("<dtml-var CName>", "<dtml-var email>", "<dtml-var =
phone>");
</TEXTAREA> </DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Yet when I run the Python script, =
I=20
get</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>
<H2>Zope Error</H2>
<P>Zope has encountered an error while publishing this =
resource.</P>
<P><STRONG>Error Type: KeyError</STRONG><BR><STRONG>Error Value:=20
CName</STRONG></P>
<P>Am I passing the variables in the wrong way from the Python =
Script? Is=20
there something wrong with the Z SQL method? In the Python script =
the=20
variables CName, email, phone are well defined. Someone, anyone =
HELP! so I=20
can actually do something besides look hopelessly at this error =
message=20
for days on end. </P></DIV></TD></TR>
<TR>
<TD vAlign=3Dtop align=3Dleft colSpan=3D2>
<DIV class=3Dform-element><INPUT class=3Dform-element =
type=3Dsubmit value=3D"Save Changes" name=3DSUBMIT>=20
<INPUT class=3Dform-element type=3Dsubmit value=3D"Change and Test" =
name=3DSUBMIT>=20
<BR><INPUT class=3Dform-element type=3Dsubmit value=3DTaller =
name=3DSUBMIT> <INPUT class=3Dform-element type=3Dsubmit value=3DShorter =
name=3DSUBMIT> <INPUT class=3Dform-element type=3Dsubmit value=3DWider =
name=3DSUBMIT> <INPUT class=3Dform-element type=3Dsubmit =
value=3DNarrower name=3DSUBMIT>=20
</DIV></TD></TR></TBODY></TABLE></FORM></DIV></BODY></HTML>
------=_NextPart_001_0006_01C2BBD2.EC796460--
------=_NextPart_000_0005_01C2BBD2.EC796460
Content-Type: image/gif;
name="sqlmethod.gif"
Content-Transfer-Encoding: base64
Content-Location: http://www.heiropure.com/misc_/ZSQLMethods/sqlmethod.gif
R0lGODlhEAAQAPcAAP8A/wAAAFBQUICAgMDAwP8AAIAAQAAAoABAgIAAgEAAQP//AP//gACAgECA
gP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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