Re: [Zope] How can I let ZSQL method know the variable i define.
hi: i really crazy about this question, i simplify the question i rewrite the code and simplify it <dtml-call "REQUEST.set('pageurl', URL0)"> <dtml-in "test_for_page_count(pageurl=pageurl)"> <dtml-in "getPageViews(pageurl=pageurl)"> <center> This page has been viewed <b><dtml-var pagecount></b> time. </center> </dtml-in> </dtml-in> it disply nothing, when i hard code pageurl variable and rewrite it like this <dtml-call "REQUEST.set('pageurl', URL0)"> <dtml-in "test_for_page_count(pageurl='/')"> <dtml-in "getPageViews(pageurl='/' )"> <center> This page has been viewed <b><dtml-var pagecount></b> time. </center> </dtml-in> </dtml-in> well, this time it works, so it means that <dtml-in "test_for_page_count(pageurl=pageurl)"> could not forward parameter to ZSQL method. even I rewrite code like this, <dtml-in "test_for_page_count(_.None,_,pageurl=pageurl)"> still does not work. i was wondering that if zope's builtin database gadfly is fit for this small code.
Hi, Try sending it throught the REQUEST since that is where you set it. If you want it to be temporary, use the <dtml-let pageurl="REQUEST['URL0']"> around the in. I personally use a little trick to put a character after every operand statement (in, if, else, except, etc) so I can see what has passed and what has failed. Nested statements can be a bit tricky if you aren’t sure where youre at. Btw, Gadfly is more than capable of meeting your needs with this. <dtml-in "getPageViews(pageurl=REQUEST['pageurl'])"> Regards, Paul Zwarts -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org] On Behalf Of Eiffel Sent: Sunday, October 28, 2001 4:16 AM To: Zope-List Subject: Re: [Zope] How can I let ZSQL method know the variable i define. hi: i really crazy about this question, i simplify the question i rewrite the code and simplify it <dtml-call "REQUEST.set('pageurl', URL0)"> <dtml-in "test_for_page_count(pageurl=pageurl)"> <dtml-in "getPageViews(pageurl=pageurl)"> <center> This page has been viewed <b><dtml-var pagecount></b> time. </center> </dtml-in> </dtml-in> it disply nothing, when i hard code pageurl variable and rewrite it like this <dtml-call "REQUEST.set('pageurl', URL0)"> <dtml-in "test_for_page_count(pageurl='/')"> <dtml-in "getPageViews(pageurl='/' )"> <center> This page has been viewed <b><dtml-var pagecount></b> time. </center> </dtml-in> </dtml-in> well, this time it works, so it means that <dtml-in "test_for_page_count(pageurl=pageurl)"> could not forward parameter to ZSQL method. even I rewrite code like this, <dtml-in "test_for_page_count(_.None,_,pageurl=pageurl)"> still does not work. i was wondering that if zope's builtin database gadfly is fit for this small code. f櫀f微二顶儕煵~ⅰ膊?j柌微櫃枈y微櫃枈y
curious... for testing i put something similar on my machine and it just works. are you certain that the URL0 value is in your db's table? just asking because you talk about hardcoding "/" whereas URL0 would return sth like "http://localhost:8080/your_folder/calling_method" btw. as Paz pointed out you dont need to use set() at all, you also can do <dtml-in "query(url=URL0)"> are you acquiring the method which performs the queries? maybe acquisition messes with your URL0 somehow; try calling the method directly. On Sun, 28 Oct 2001, Eiffel wrote:
hi: i really crazy about this question, i simplify the question
i rewrite the code and simplify it
<dtml-call "REQUEST.set('pageurl', URL0)"> <dtml-in "test_for_page_count(pageurl=pageurl)"> <dtml-in "getPageViews(pageurl=pageurl)"> <center> This page has been viewed <b><dtml-var pagecount></b> time. </center> </dtml-in> </dtml-in>
it disply nothing, when i hard code pageurl variable and rewrite it like this
<dtml-call "REQUEST.set('pageurl', URL0)"> <dtml-in "test_for_page_count(pageurl='/')"> <dtml-in "getPageViews(pageurl='/' )"> <center> This page has been viewed <b><dtml-var pagecount></b> time. </center> </dtml-in> </dtml-in>
well, this time it works, so it means that
<dtml-in "test_for_page_count(pageurl=pageurl)"> could not forward parameter to ZSQL method.
even I rewrite code like this,
<dtml-in "test_for_page_count(_.None,_,pageurl=pageurl)">
still does not work.
i was wondering that if zope's builtin database gadfly is fit for this small code.
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÙ¢¦j)eËÿf^ÿ:){ú+m§ÿÿ+-³üè¥ïè®æj)fjåËbú?Î^ÿóhrº,²,¶Ê+3zw(v)àÿÿÿEéZµçeËlþm§ÿÿ+-³üè¥ïè®æj)fjåËbú?Î^ý©ç¢éÜzm§ÿÿ+-³üè¥ïè®æj)fjåËbú?Î^ýׯ
-- _________________________________________________ peter sabaini, mailto: sabaini@niil.at -------------------------------------------------
participants (3)
-
Eiffel -
Paz -
Peter Sabaini