blob: 3769b19b1ab08b21807993ff8b49d9efb5c1826e [file] [log] [blame]
Tony Mack050ca932013-04-08 15:08:02 -04001import ast
Tony Mack82aa4f02013-04-08 17:45:42 -04002from django.http.request import QueryDict
Tony Mackbe12a202013-04-08 15:07:20 -04003
4def parse_request(request):
5 d = {}
Tony Mack82aa4f02013-04-08 17:45:42 -04006 if isinstance(request, unicode):
7 d = ast.literal_eval(request)
8 elif isinstance(request, QueryDict):
9 for (k,v) in request.items():
10 d[k] = ast.literal_eval(v)
Tony Mack1daa5442013-04-08 19:39:57 -040011 elif isinstance(request, dict):
12 d = request
13
Tony Mack1e096592013-04-08 15:11:38 -040014 return d