> Better would be to do:
>
> for name, value in self.request().fields().items():
>
> which will work, and also saves an additional dictionary lookup for each
> item.
>
> 2) You need to encode the value in case it contains a double-quote
> character. value.replace('"', '"') should do the trick I think.
Check. Let me know what you think of the attached patch.
> 3) I believe that the values in the dict can be strings OR lists of strings.
> So you need to check if the value is a list, and if so, loop over the items
> in the list and output a separate hidden field for each item in the list.
> This will happen with a URL like /foo/bar?field=foo&field=bar in which case
> you'll have a fields dict like {'field': ['foo', 'bar']} I think.
I haven't tried explicitly checking for type list, but I've tried this with
multiple values, and it works fine. Do you still suggest handling type list?
Steve
56c56,61
< <input type="hidden" name="loginid" value="%s">
---
> <input type="hidden" name="loginid" value="%s">''' % (action, loginid))
> # Forward any passed in values to the user's intended page after successful login
> for name, value in self.request().fields().items():
> self.write('''
> <input type="hidden" name="%s" value="%s">''' % (self.htmlEncode(name), self.htmlEncode(value)))
> self.write('''
62c67
< ''' % (action, loginid))
---
> ''')