[Zope] build a query string out of a dictionary (REQUEST.form)

Dieter Maurer dieter@handshake.de
Wed, 11 Jul 2001 20:46:18 +0200 (CEST)


Andy McKay writes:
 > for k, v in context.REQUEST.form.items():
 >     if k == 'foo':
 >         # do something
 >     else:
 >         somestr = '%s&%s=%s' % (somestr, k, v)
Do not forget quoting:
  
    Query string fragments must be "urllib.quote_plus"ed.

	  from urllib import quote_plus

	  .....
	    somestr = "%s&%s=%s" % (somestr, quote_plus(k), quote_plus(v))


Dieter