[Zope] Quick question on ZSQL methods...

Jim Sanford jsanford@atinucleus.com
Wed, 8 Sep 1999 23:36:12 -0500


The following snippet if from a working ZSQL Method that I use as wrapper to
every data request. (There are a wide range of permissions that can changes
dynamically - I am pulling the from our in house database which is in
regular use by over 100 people internally. The Zope site I am devoloping
will make this data available to our worldwide sales people and
distributors.)

"...from online where username == <!--#sqlvar
"REQUEST.get('AUTHENTICATED_USER')" type=string-->"

(haven't yet converted the code to the new DTML syntax.)

----- Original Message -----
From: Andrew Kenneth Milton <akm@mail.theinternet.com.au>
To: <jcoleman@austin.rr.com>
Cc: <zope@zope.org>
Sent: Wednesday, September 08, 1999 9:51 PM
Subject: Re: [Zope] Quick question on ZSQL methods...


>
+----[ 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.
>
>
> --
> Totally Holistic Enterprises Internet|  P:+61 7 3870 0066   |  Andrew
> The Internet (Aust) Pty Ltd          |  F:+61 7 3870 4477   |  Milton
> ACN: 082 081 472                     |  M:+61 416 022 411   |72 Col .Sig
> PO Box 837 Indooroopilly QLD 4068    |akm@theinternet.com.au|Specialist
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
>
> (To receive general Zope announcements, see:
> http://www.zope.org/mailman/listinfo/zope-announce
>
> For developer-specific issues, zope-dev@zope.org -
> http://www.zope.org/mailman/listinfo/zope-dev )
>