# HG changeset patch # User Goffi # Date 1506264639 -7200 # Node ID 968eda9e982abeff34f6ca5a01c1074d755c5c24 # Parent 3c81203840a4050e190588c9250e225704c2a1ea server: added getAllPostedData diff -r 3c81203840a4 -r 968eda9e982a src/server/server.py --- a/src/server/server.py Sun Sep 24 16:49:23 2017 +0200 +++ b/src/server/server.py Sun Sep 24 16:50:39 2017 +0200 @@ -1750,6 +1750,23 @@ return ret[0] if get_first else ret + def getAllPostedData(self, request, except_=()): + """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 + @return (dict[unicode, list[unicode]]): post values + """ + except_ = tuple(except_) + (u'csrf_token',) + ret = {} + for key, values in request.args.iteritems(): + key = urllib.unquote(key).decode('utf-8') + if key in except_: + continue + ret[key] = [urllib.unquote(v).decode('utf-8') for v in values] + return ret + def getProfile(self, request): """helper method to easily get current profile