authenticated_user in Z SQL method not defined
Hi, I'm using the exUserFolder together with a PostgreSQL-db to log in users. Works so far. With <dtml-var "AUTHENTICATED_USER.getUserName()"> I get the username which is the same as the field "username" in the db users. But I can not use AUTHENTICATED_USER in an sql-querry like SELECT foo FROM users WHERE username=<dtml-var "AUTHENTICATED_USER.getUserName()" sql_quote>; Why is AUTHENTICATED_USER not availabel in Z SQL methods? Traceback (innermost last): * Module ZPublisher.Publish, line 98, in publish * Module ZPublisher.mapply, line 88, in mapply * Module ZPublisher.Publish, line 39, in call_object * Module Shared.DC.ZRDB.DA, line 328, in manage_test * Module Shared.DC.ZRDB.DA, line 306, in manage_test * Module Shared.DC.ZRDB.DA, line 415, in __call__ * Module DocumentTemplate.DT_String, line 474, in __call__ * Module DocumentTemplate.DT_Var, line 221, in render * Module DocumentTemplate.DT_Util, line 201, in eval __traceback_info__: AUTHENTICATED_USER * Module <string>, line 2, in f Error, exceptions.NameError: global name 'AUTHENTICATED_USER' is not defined Regards Christoph
On Fri, 17 Oct 2003 17:06:52 +0200 GMT Christoph Landwehr asked the Zope mailinglist about the following:
But I can not use AUTHENTICATED_USER in an sql-querry like SELECT foo FROM users WHERE username=<dtml-var "AUTHENTICATED_USER.getUserName()" sql_quote>;
Why is AUTHENTICATED_USER not availabel in Z SQL methods?
try something like : <dtml-sqlvar expr="_.SecurityGetUser().getUserName()" type=string> http://zope.org/Documentation/Books/ZopeBook/2_6Edition/Security.stx :) -- __________________________________________________________________ Geir Bækholt · Interaction Architect · Plone Solutions Development · Training · Support · http://www.plonesolutions.com __________________________________________________________________
Christoph Landwehr wrote at 2003-10-17 17:06 +0200:
But I can not use AUTHENTICATED_USER in an sql-querry like SELECT foo FROM users WHERE username=<dtml-var "AUTHENTICATED_USER.getUserName()" sql_quote>;
Why is AUTHENTICATED_USER not availabel in Z SQL methods?
"REQUEST" is not added to the DTML namespace of the Z SQL method's pattern. You can try "REQUEST.AUTHENTICATED_USER.getUserName()". Dieter
participants (3)
-
Christoph Landwehr -
Dieter Maurer -
Geir B�kholt