Mercurial > odfcast > odfcast
diff odfcast/convert.py @ 67:5d1e486140ae
Support merging of pdf documents with different names in the uploaded data
This is mostly a fix for older python requests versions which don't allow to
send several files for one form name.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Mon, 01 Dec 2014 16:04:32 +0100 |
parents | 16352bd395fa |
children | 02efda1f6919 |
line wrap: on
line diff
--- a/odfcast/convert.py Fri Nov 28 14:58:51 2014 +0100 +++ b/odfcast/convert.py Mon Dec 01 16:04:32 2014 +0100 @@ -196,7 +196,14 @@ log.debug("Merging PDF documents") merger = PdfFileMerger() - ffiles = request.files.getlist('files') + + ffiles = [] + + # allow files to have arbitray form names + # order files by their form names + for key, value in sorted(request.files.iterlists(), + key=lambda x: x[0].lower()): + ffiles.extend(value) for ffile in ffiles: try: