[Zope] what is wrong with this python code?

Dylan Reinhardt zope at dylanreinhardt.com
Fri Nov 7 12:54:30 EST 2003


On Fri, 2003-11-07 at 11:44, Yurj wrote:
> if query.find('&page=') != -1:
> query = query[:query.find('&page=')]

At the very least, you have an indentation problem.

> 
> (aim to strip out all after &page= in a query string)

Is that *really* what you want to do?  I don't think *I* would want to
rely on query strings being presented in a particular order.

I'm guessing what you really want is to parse out the value of several
variables.  If so, why not just let Zope do the heavy lifting?

-----
my_var = request.get('some_var')
if my_var:
    do_stuff()
-----

HTH,

Dylan




More information about the Zope mailing list