Merge pull request 'transmit multiple occurence of an argument into a list' (#130) from jmplace/ScoDoc-Lille:fix_multivalued_args into master

Reviewed-on: https://scodoc.org/git/viennet/ScoDoc/pulls/130
This commit is contained in:
Emmanuel Viennet 2021-09-21 16:49:41 +02:00
commit 7214627994

View File

@ -74,7 +74,8 @@ class ZRequest(object):
if k.endswith(":list"): if k.endswith(":list"):
self.form[k[:-5]] = request.args.getlist(k) self.form[k[:-5]] = request.args.getlist(k)
else: else:
self.form[k] = request.args[k] values = request.args.getlist(k)
self.form[k] = values[0] if len(values) == 1 else values
# current_app.logger.info("ZRequest.form=%s" % str(self.form)) # current_app.logger.info("ZRequest.form=%s" % str(self.form))
self.RESPONSE = ZResponse() self.RESPONSE = ZResponse()