From e7f88ddf32eaea237fc72c5b8abdbb001fa38d7b Mon Sep 17 00:00:00 2001 From: Rune Halvorsen Date: Tue, 21 Apr 2009 00:21:31 +0200 Subject: [PATCH] Tried making the weird_post_data parser a little cleaner --- djangopypi/views.py | 6 ++---- 1 file 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 def parse_weird_post_data(raw_post_data): """ For some reason Django can't parse the HTTP POST data sent by ``distutils`` register/upload commands. - + This parser should be able to so, and returns a :class:`django.utils.datastructures.MultiValueDict` as you would expect from a regular ``request.POST`` object. @@ -57,9 +57,7 @@ def parse_weird_post_data(raw_post_data): items = raw_post_data.split(sep) post_data = {} files = {} - for part in items: - if not part.strip(): - continue + for part in [e for e in items if not e.isspace()]: item = part.splitlines() if len(item) < 2: continue header = item[1].replace("Content-Disposition: form-data; ", "")