If you want an external method to do something with the REQUEST, you have to pass it as a parameter when you call that external method. Otherwise the method won't know anything about it. Also, there is not an instrinsic "self" parameter in a python function call. All you need to do is something like this in the Zope page that calls the external method: <dtml-var "the_external_method(REQUEST)"> And in the external method: def the_external_method(request): # Code to work with the request goes here # For example: some_variable=request['the_variable_name'] # ... return thedata # Assuming that you have some data to return No muss, no fuss, no selfs. Cheers, Tom P [Ben Ocean] To: "Max M" <maxm@mxm.dk> Cc: <zope@zope.org> Sent: Wednesday, January 30, 2002 12:01 PM Subject: Re: [Zope] Problems with External Script At 03:05 PM 1/30/02 +0000, you wrote: When you use external scripts you don't use context. Just use self as you would normally do in a python script.
def externalMethod(self): return self.blah
It throws the same error, but with 'self': Site Error An error was encountered while publishing this resource. Error Type: NameError Error Value: global name 'self' is not defined Troubleshooting Suggestions · This resource may be trying to reference a nonexistent object or variable global name 'self' is not defined. · 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. Again, here's the script: import string def myaffiliateprogram(): user_id, banner_id, page = self.REQUEST['user_id'],self.REQUEST['banner_id'],self.REQUEST['page'] redirect = "http://www.myaffiliateprogram.com/u/%(user_id)s/t.asp?id=%(banner_id)s&p=%( page)s" % locals() print "Location: %(redirect)s\n" % locals() The idea of the script is to have someone hit the page (which has only this External Method) and be redirected. Obviously, I'm missing something fundamental here. Ideas? 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 )