[Zope] Bug in PostGre adapter for Zope, for type string in arguments of ZSQL Methods (?)

acg acarrasco@udiberica.com
Thu, 23 Aug 2001 12:45:58 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_0042_01C12BD1.8EE29DE0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

(ok, sorry, i=B4m spanish.. ;-D)
I=B4m trying to do something like this in a ZSQLMethod:
    select * from table_name where table_field1=3D<dtml-sqlvar argument1 =
type=3Dint>;

And it works successfully. But if I try with:
    select * from table_name where table_field2=3D<dtml-sqlvar argument2 =
type=3Dstring>;

I get an unexpected error:
   =20
Error, exceptions.NameError: global name 'string' is not defined=20
-------------------------------------------------------------------------=
-------
SQL used:

Could not render the query template!

I have tried some another ways to access the query:
    select * from table_name where table_field2=3D'<dtml-sqlvar =
argument2 type=3Dstring>';
    select * from table_name where table_field2=3D<dtml-sqlvar argument2 =
type=3D"string">;
    select * from table_name where table_field2=3D'<dtml-sqlvar =
argument2 type=3D"string">';
    ...
But, nothing. If i try this:
    select * from table_name where table_field2=3D'value';
It works successfully again.

Why can=B4t Zope render the query template?=20
Why does Zope say "globla name string is not defined"?

I=B4m using...
    Zope 2.4.0
    Python 2.1.1
    Linux
    ZPoPyDa (Last Version? I=B4m not sure of this)
I need the Help. Every comments can help me. Thanks.

Antonio Carrasco









------=_NextPart_000_0042_01C12BD1.8EE29DE0
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.3103.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>(ok, sorry, i=B4m spanish.. =
;-D)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I=B4m trying to do something like this =
in a=20
ZSQLMethod:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;select&nbsp;* =
from=20
table_name where table_field1=3D&lt;dtml-sqlvar argument1=20
type=3Dint&gt;;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>And it works successfully. But if I try =

with:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; select * from =
table_name where=20
table_field2=3D&lt;dtml-sqlvar argument2 type=3Dstring&gt;;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I get an unexpected error:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; </FONT></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>Error,=20
<EM>exceptions.NameError</EM>:</STRONG> global name 'string' is not =
defined=20
<HR>
<STRONG>SQL used:</STRONG><BR><PRE>Could not render the query template!
</PRE></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I have tried some another ways to =
access the=20
query:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; select * from =
table_name where=20
table_field2=3D'&lt;dtml-sqlvar argument2 =
type=3Dstring&gt;';</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; select * from =
table_name where=20
table_field2=3D&lt;dtml-sqlvar argument2 =
type=3D"string"&gt;;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; select * from =
table_name where=20
table_field2=3D'&lt;dtml-sqlvar argument2 =
type=3D"string"&gt;';</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; ...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>But, nothing. If i try =
this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; select * from =
table_name where=20
table_field2=3D'value';</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>It works successfully =
again.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Why can=B4t Zope render the query =
template?=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Why does Zope say "globla name string =
is not=20
defined"?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I=B4m using...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; Zope =
2.4.0</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; Python =
2.1.1</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; Linux</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; ZPoPyDa (Last =
Version? I=B4m not=20
sure of this)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I need the Help. Every comments can =
help me.=20
Thanks.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Antonio Carrasco</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></FONT>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0042_01C12BD1.8EE29DE0--