[Zope] ZCatalog Query and request passed by a form
Benoit Dominiak
benoit.dominiak@makinacorpus.com
Tue, 7 Aug 2001 11:06:30 +0100
This is a multi-part message in MIME format.
------=_NextPart_000_000C_01C11F31.030C97A0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hi everybody,
I've worked on it for 2 weeks and can't find the answer...
I've got a form where you can select some parameters and search (with
ZCatalog) for them in my ZClass instances. Everything was perfect until I
tryed to use ZCatalog Query to perform "or" search.
<dtml-call "REQUEST.set('results', Catalog.query('type == ``Support de
vente`` or physique == ``Book``',))"> works but this is not what I wanted...
a.. <dtml-call "REQUEST.set('results', Catalog.query('type == typ or
physique == physiqu', REQUEST))">
b.. <dtml-call "REQUEST.set('results', Catalog.query('type == typ or
physique == physiqu'))">
Error Type: NameError Error Value: type
a.. <dtml-call "REQUEST.set('results', Catalog.query('type ==
REQUEST.form[``typ``]', REQUEST))"> error REQUEST
b.. <dtml-call "REQUEST.set('results', Catalog.query('type ==
REQUEST.form[``typ``]'))"> error getitem type
I've even try with a python script :
ret=context.Catalog.query('physique == ``Book`` or type == typ')
return ret
ERROR getitem (typ)
How can I do ? Please help me...
Benoit.
------=_NextPart_000_000C_01C11F31.030C97A0
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></HEAD>
<BODY>
<DIV><SPAN class=3D960505109-07082001>Hi everybody,</SPAN></DIV>
<DIV><SPAN class=3D960505109-07082001></SPAN> </DIV>
<DIV align=3Dleft><SPAN class=3D960505109-07082001>I've worked on it for =
2 weeks and=20
can't find the answer...</SPAN></DIV>
<DIV align=3Dleft><SPAN class=3D960505109-07082001>I've got a form where =
you can=20
select some parameters and search (with ZCatalog) for them in my ZClass=20
instances. Everything was perfect until I tryed to use ZCatalog =
Query to=20
perform "or" search.</SPAN></DIV>
<DIV align=3Dleft><SPAN class=3D960505109-07082001>
<P><dtml-call "REQUEST.set('results', Catalog.query('type =
=3D=3D <SPAN=20
class=3D960505109-07082001>``Support de vente``</SPAN> or physique =
=3D=3D <SPAN=20
class=3D960505109-07082001>``Book``</SPAN>',<SPAN=20
class=3D960505109-07082001>)</SPAN>)"><SPAN =
class=3D960505109-07082001> works but=20
this is not what I wanted...</SPAN></P></SPAN></DIV><SPAN=20
class=3D960505109-07082001>
<DIV align=3Dleft>
<UL>
<LI><dtml-call "REQUEST.set('results', Catalog.query('type =3D=3D =
typ or=20
physique =3D=3D physiqu', <SPAN class=3D960505109-07082001>=20
</SPAN>REQUEST))"></LI>
<LI>
<P><SPAN class=3D960505109-07082001></SPAN><dtml-call =
"REQUEST.set('results',=20
Catalog.query('type =3D=3D typ or physique =3D=3D =
physiqu'))"></P></LI></UL></DIV>
<P>Error Type: NameError<SPAN=20
class=3D960505109-07082001> =
</SPAN>Error=20
Value: type</P>
<UL>
<LI><dtml-call "REQUEST.set('results', Catalog.query('type =3D=3D=20
REQUEST.form[``typ``]<SPAN class=3D960505109-07082001>'</SPAN>,=20
REQUEST))"><SPAN class=3D960505109-07082001> error =
REQUEST</SPAN></LI>
<LI><dtml-call "REQUEST.set('results', Catalog.query('type =3D=3D=20
REQUEST.form[``typ``]'))"><SPAN class=3D960505109-07082001> error =
getitem=20
type</SPAN></LI></UL>
<DIV><SPAN class=3D960505109-07082001>I've even try with a python script =
:</SPAN></DIV>
<DIV><SPAN =
class=3D960505109-07082001>ret=3Dcontext.Catalog.query('physique =3D=3D=20
``Book`` or type =3D=3D typ')</SPAN></DIV>
<DIV><SPAN class=3D960505109-07082001>return ret</SPAN></DIV>
<DIV><SPAN class=3D960505109-07082001>ERROR getitem (typ)</SPAN></DIV>
<DIV><SPAN class=3D960505109-07082001></SPAN> </DIV>
<DIV><SPAN class=3D960505109-07082001>How can I do ? Please help=20
me...</SPAN></DIV>
<DIV><SPAN class=3D960505109-07082001></SPAN> </DIV>
<DIV><SPAN class=3D960505109-07082001>Benoit.</SPAN></DIV>
<P> </P></SPAN></BODY></HTML>
------=_NextPart_000_000C_01C11F31.030C97A0--