[Zope] getting queries of a database into variables?

Dieter Maurer dieter@handshake.de
Thu, 6 Jul 2000 22:48:41 +0200 (CEST)


Rajil Saraswat writes:
 > .... How do i put up queried data
 > into variables so i can conditionally check them?
The result of an Z SQL method behaves like a list of
row objects. Each row object behaves like an object with
the columns as attributes.

Thus you can use:

<dtml-let  query_result=Z_SQL_method  <-- behaves like a list -->
	   hits="_.len(query)"        <-- number of hits-->
	   >
   <dtml-if hits>
     <dtml-with "query[0]">           <-- opens direct access to columns of hit 1 -->
       <dtml-var column1>
       .....
     </dtml-with>
   </dtml-if>
</dtml-let>

 > Does there exist some readymade package for setting up cookie based
 > authorization. i could locate someting called LoginManager, but how do i
 > use it.
Have a look at the Zope product GUF (Generic User Folder)
--> zope.org; see also the respective HowTows.



Dieter