Re: [Zope] External Method Problem
Hi JIM PENNY and HARRY WILKINSON and all others; I tried both of your suggestions, but now I get the below complaint with either *context* or *REQUEST* being the NameError. Perhaps I need to import another module? TIA, BenO At 11:51 AM 1/29/02 -0500, you wrote:
On Tue, Jan 29, 2002 at 07:13:21AM -0800, Ben Ocean wrote:
Hi; I have this external method:
import string, os
user_id, banner_id, page = os.environ['QUERY_STRING'].split("&") redirect =
"http://www.myaffiliateprogram.com/u/%(user_id)s/t.asp?id=%(banner_id)s&p=%(p..."
% locals() print "Location: %(redirect)s\n" % locals()
but when I try and instantiate it as an external method I get this error:
As I read this, you are asking for the variable QUERY_STRING that comes from the shell. There is none.
I think that you are trying to get the QUERY_STRING that comes from the browser. That would be (I am guessing here (untested)) REQUEST['QUERY_STRING'], or maybe just QUERY_STRING, if you declared it as a parameter and passed it in.
Jim
Site Error An error was encountered while publishing this resource. Error Type: KeyError Error Value: QUERY_STRING
Troubleshooting Suggestions · This resource may be trying to reference a nonexistent object or variable QUERY_STRING. · The URL may be incorrect. · The parameters passed to this resource may be incorrect. · A resource that this resource relies on may be encountering an error. For more detailed information about the error, please refer to the HTML source for this page. If the error persists please contact the site maintainer. Thank you for your patience.
What to do? TIA, BenO
_______________________________________________ Zope maillist - Zope@zope.org 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 )
On Tue, Jan 29, 2002 at 11:39:06AM -0800, Ben Ocean wrote:
Hi JIM PENNY and HARRY WILKINSON and all others; I tried both of your suggestions, but now I get the below complaint with either *context* or *REQUEST* being the NameError. Perhaps I need to import another module? TIA, BenO
No, no, no..... Perhaps you need to show us what you are using as the definition of the function. Do you have a self parameter? If so, it should be available as self.REQUEST. i.e. is your funcion headed def my_func(self): (or def my_func(self, parameter_list) ) Or alternatively, define my_func(REQUEST): Most of my code has def my_func(self, REQUEST, ...) Then I know what I have passed in to the function! Jim
Oops! My bad. Everything working fine now :)) Thanks, BenO At 02:54 PM 1/29/02 -0500, you wrote:
On Tue, Jan 29, 2002 at 11:39:06AM -0800, Ben Ocean wrote:
Hi JIM PENNY and HARRY WILKINSON and all others; I tried both of your suggestions, but now I get the below complaint with either *context* or *REQUEST* being the NameError. Perhaps I need to import another module? TIA, BenO
No, no, no.....
Perhaps you need to show us what you are using as the definition of the function. Do you have a self parameter? If so, it should be available as self.REQUEST. i.e. is your funcion headed def my_func(self): (or def my_func(self, parameter_list) )
Or alternatively, define my_func(REQUEST):
Most of my code has def my_func(self, REQUEST, ...)
Then I know what I have passed in to the function!
Jim
participants (2)
-
Ben Ocean -
Jim Penny