[Zope] Quick question on ZSQL methods...

Odysseus@interport.net Odysseus@interport.net
Wed, 8 Sep 1999 23:28:13 -0400 (EDT)


How about this, in the ZSQL Method:

select * from accounts
where name = <dtml-sqlvar AUTHENTICATED_USER>

or maybe: name = <dtml-sqlvar "REQUEST['AUTHENTICATED_USER']">

or even: name = <dtml-sqlvar username>
then in a DTML Method:
<dtml-call "ZSQLMethod(username=REQUEST['AUTHENTICATED_USER']">

Hope these are somewhere in the ballpark.

-Lance


On  9 Sep, Andrew Kenneth Milton wrote:
> +----[ jcoleman@austin.rr.com ]---------------------------------------------
> | I was writing a SQL method to pull one record out of a database that
> | contains account information for the current authenticated user, and
> | it's not recognizing the <!--#var AUTHENTICATED_USER--> in the ZSQL
> | method:
> | 
> | select * from accounts
> |  where name = '<!--#var AUTHENTICATED_USER-->';
> | 
> | Zope tells me:
> | 
> | 
> | Error, exceptions.KeyError: AUTHENTICATED_USER
> | SQL used:
> | Could not render the query template!
> | 
> | 
> | Substituting <!--#var AUTHENTICATED_USER--> with an actual name works
> | fine.  Any ideas on how to get this to work?  Or am I going about this
> | all wrong?
> 
> <!--#call "REQUEST.set('username',_.str(AUTHENTICATED_USER))" -->
> 
> I use this, and then refer to username from then on. 
> 
>