[Zope] External Method Problem

Harry Wilkinson harryw@nipltd.com
Tue, 29 Jan 2002 16:46:14 +0000


Are you sure you're supposed to be getting the query string from your 
operating system environment?  It seems more likely that you were intending 
to get it from the request.

It's not clear exactly what you're intending this code to do, but if you want 
to get the quesry string from the request, try replacing this line:

user_id, banner_id, page = os.environ['QUERY_STRING'].split("&")

with this:

r = context.REQUEST
user_id, banner_id, page = r['user_id'], r['banner_id'], r['page']

but change the names of the query string variables if they're different.


HarryW

On Tuesday 29 January 2002 3:13 pm, 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=%
>(page)s" % locals()
> print "Location: %(redirect)s\n" % locals()
>
> but when I try and instantiate it as an external method I get this error:
>
> 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 )