# HG changeset patch # User Björn Ricks # Date 1417446272 -3600 # Node ID 5d1e486140ae4ac62b9ca59fdabef937e9e1b52d # Parent 76838e53434c1a1b1799e2831d416f60f50269a6 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. diff -r 76838e53434c -r 5d1e486140ae odfcast/convert.py --- 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: