aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRune Halvorsen <runeh@vorkosigan.(none)>2009-04-21 00:21:31 +0200
committerRune Halvorsen <runeh@vorkosigan.(none)>2009-04-21 00:21:31 +0200
commite7f88ddf32eaea237fc72c5b8abdbb001fa38d7b (patch)
tree2cc9fd6d2a4fd5575c6a355c019120240697bc42
parent2edd9f1101c18685ad7c279fdd2c014572aa59a2 (diff)
downloadchishop-e7f88ddf32eaea237fc72c5b8abdbb001fa38d7b.tar.bz2
chishop-e7f88ddf32eaea237fc72c5b8abdbb001fa38d7b.tar.xz
chishop-e7f88ddf32eaea237fc72c5b8abdbb001fa38d7b.zip
Tried making the weird_post_data parser a little cleaner
-rw-r--r--djangopypi/views.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/djangopypi/views.py b/djangopypi/views.py
index 29494a7..5ed27d4 100644
--- a/djangopypi/views.py
+++ b/djangopypi/views.py
@@ -46,7 +46,7 @@ from djangopypi.http import HttpResponseUnauthorized
46def parse_weird_post_data(raw_post_data): 46def parse_weird_post_data(raw_post_data):
47 """ For some reason Django can't parse the HTTP POST data 47 """ For some reason Django can't parse the HTTP POST data
48 sent by ``distutils`` register/upload commands. 48 sent by ``distutils`` register/upload commands.
49 49
50 This parser should be able to so, and returns a 50 This parser should be able to so, and returns a
51 :class:`django.utils.datastructures.MultiValueDict` 51 :class:`django.utils.datastructures.MultiValueDict`
52 as you would expect from a regular ``request.POST`` object. 52 as you would expect from a regular ``request.POST`` object.
@@ -57,9 +57,7 @@ def parse_weird_post_data(raw_post_data):
57 items = raw_post_data.split(sep) 57 items = raw_post_data.split(sep)
58 post_data = {} 58 post_data = {}
59 files = {} 59 files = {}
60 for part in items: 60 for part in [e for e in items if not e.isspace()]:
61 if not part.strip():
62 continue
63 item = part.splitlines() 61 item = part.splitlines()
64 if len(item) < 2: continue 62 if len(item) < 2: continue
65 header = item[1].replace("Content-Disposition: form-data; ", "") 63 header = item[1].replace("Content-Disposition: form-data; ", "")