# HG changeset patch # User Goffi # Date 1515790828 -3600 # Node ID b57f86bc117768cf229fa3d0f91e36239a306d7b # Parent 1593e00078d239917300964b23b354d900c1f0ab pages: added "multiple" argument to getAllPostedData diff -r 1593e00078d2 -r b57f86bc1177 src/server/pages.py --- a/src/server/pages.py Fri Jan 12 18:03:34 2018 +0100 +++ b/src/server/pages.py Fri Jan 12 22:00:28 2018 +0100 @@ -822,12 +822,13 @@ return ret[0] if get_first else ret - def getAllPostedData(self, request, except_=()): + def getAllPostedData(self, request, except_=(), multiple=True): """get all posted data @param request(server.Request): request linked to the session @param except_(iterable[unicode]): key of values to ignore csrf_token will always be ignored + @param multiple(bool): if False, only the first values are returned @return (dict[unicode, list[unicode]]): post values """ except_ = tuple(except_) + (u'csrf_token',) @@ -836,7 +837,10 @@ key = urllib.unquote(key).decode('utf-8') if key in except_: continue - ret[key] = [urllib.unquote(v).decode('utf-8') for v in values] + if not multiple: + ret[key] = urllib.unquote(values[0]).decode('utf-8') + else: + ret[key] = [urllib.unquote(v).decode('utf-8') for v in values] return ret def getProfile(self, request):