RE: [Zope] ZSQL Method & AUTHENTICATED_USER
I have an approach that works for me, but it may be a bit awkward. I have a SQL method (dbGetUserID) which takes AUTHENTICATED_USER as an argument and finds the value from the "userid" field in the database: select userid from users where shortname = When I need to perform database ops on the user, I just call this method and use the resulting id, eg, insert into sometable (userid, otherfield) values (, ) I have AUTHENTICATED_USER in the parameter list for this SQL method as well, though it may not need to be... Steve -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Jon Prettyman Sent: Thursday, 19 October 2000 8:18 To: [EMAIL PROTECTED] Subject: Re: [Zope] ZSQL Method & AUTHENTICATED_USER I'm pretty sure that all variables have to be passed in explicitly with SQLMethods. Namespaces are not passed in. Try specifying username as an argument in the ZSQLMethods edit form and pass it in like this: (Untested) -jon Aaron Straup Cope <[EMAIL PROTECTED]> writes: > Hi, > > I'm trying to perform a simple MySQL lookup based on the > AUTHENTICATED_USER. When I test the ZSQL method from the management > interface, everything works fine. However, when I try to call the method > from a DTML document, [it] returns nothing. > > Is this a namespace issue? I'm stumped and hoping that I'm not staring > right past the problem. Can anyone point out what it is I am doing > wrong? Thanks, > > a) DTML Document : foo > > > > > > > > b) ZSQL Method : people.lookup_by_username > > select * from people where username = " "REQUEST.AUTHENTICATED_USER.getUserName()">" > > > > ___ > Zope maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] ZSQL Method & AUTHENTICATED_USER
Thanks. It was a syntax issue. I think I tried every single variation on passing variables to the method except that one. Sorry for the bother, folks... :-) On 18 Oct 2000, Jon Prettyman wrote: > I'm pretty sure that all variables have to be passed in explicitly > with SQLMethods. Namespaces are not passed in. > > Try specifying username as an argument in the ZSQLMethods edit form > and pass it in like this: > "lookup_by_username(username=REQUEST.AUTHENTICATED_USER.getUserName()"> > > (Untested) > > -jon > > Aaron Straup Cope <[EMAIL PROTECTED]> writes: > > > Hi, > > > > I'm trying to perform a simple MySQL lookup based on the > > AUTHENTICATED_USER. When I test the ZSQL method from the management > > interface, everything works fine. However, when I try to call the method > > from a DTML document, [it] returns nothing. > > > > Is this a namespace issue? I'm stumped and hoping that I'm not staring > > right past the problem. Can anyone point out what it is I am doing > > wrong? Thanks, > > > > a) DTML Document : foo > > > > > > > > > > > > > > > > b) ZSQL Method : people.lookup_by_username > > > > select * from people where username = " > "REQUEST.AUTHENTICATED_USER.getUserName()">" > > > > > > > > ___ > > Zope maillist - [EMAIL PROTECTED] > > http://lists.zope.org/mailman/listinfo/zope > > ** No cross posts or HTML encoding! ** > > (Related lists - > > http://lists.zope.org/mailman/listinfo/zope-announce > > http://lists.zope.org/mailman/listinfo/zope-dev ) > > ___ > Zope maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope-dev ) > > ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] ZSQL Method & AUTHENTICATED_USER
I'm pretty sure that all variables have to be passed in explicitly with SQLMethods. Namespaces are not passed in. Try specifying username as an argument in the ZSQLMethods edit form and pass it in like this: (Untested) -jon Aaron Straup Cope <[EMAIL PROTECTED]> writes: > Hi, > > I'm trying to perform a simple MySQL lookup based on the > AUTHENTICATED_USER. When I test the ZSQL method from the management > interface, everything works fine. However, when I try to call the method > from a DTML document, [it] returns nothing. > > Is this a namespace issue? I'm stumped and hoping that I'm not staring > right past the problem. Can anyone point out what it is I am doing > wrong? Thanks, > > a) DTML Document : foo > > > > > > > > b) ZSQL Method : people.lookup_by_username > > select * from people where username = " "REQUEST.AUTHENTICATED_USER.getUserName()">" > > > > ___ > Zope maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )