[Zope] Problems with External Script
Ben Ocean
zope@thewebsons.com
Wed, 30 Jan 2002 09:28:08 -0800
At 05:17 PM 1/30/02 +0000, you wrote:
>Naturally ... because you forget to pass the "self"
>
>def myaffiliateprogram(self):
Well, that's what I thought too, but when I do that, then Zope throws the=20
error that I haven't given an argument when one is called for. I call the=20
script thus:
<dtml-var myaffiliateprogram>
with no argument because there isn't a need to pass one. Even if I do throw=
=20
a bogus argument in:
<dtml-var myaffiliateprogram(foo')>
it still throws the error about self.
BenO
P.S. For those following along, here's the skinny:
Site Error
An error was encountered while publishing this resource.
Error Type: NameError
Error Value: global name 'self' is not defined
Troubleshooting Suggestions
=B7 This resource may be trying to reference a nonexistent object or=
=20
variable global name 'self' is not defined.
=B7 The URL may be incorrect.
=B7 The parameters passed to this resource may be incorrect.
=B7 A resource that this resource relies on may be encountering an=
error.
For more detailed information about the error, please refer to the HTML=20
source for this page.
If the error persists please contact the site maintainer. Thank you for=20
your patience.
Again, here's the script:
import string
def myaffiliateprogram():
user_id, banner_id, page =3D=20
self.REQUEST['user_id'],self.REQUEST['banner_id'],self.REQUEST['page']
redirect =3D=20
"http://www.myaffiliateprogram.com/u/%(user_id)s/t.asp?id=3D%(banner_id)s&p=
=3D%(page)s"=20
% locals()
print "Location: %(redirect)s\n" % locals()