Code

Ticket #4947: 1.diff

File 1.diff, 1.3 KB (added by eibaan@…, 7 years ago)
Line 
1Index: __init__.py
2===================================================================
3--- __init__.py (revision 5741)
4+++ __init__.py (working copy)
5@@ -16,6 +16,16 @@
6 class Http404(Exception):
7     pass
8 
9+class FileDict(dict):
10+  class Omitted:
11+    def __repr__(self): return "<omitted>"
12+  def __repr__(self):
13+    if 'content' in self:
14+      d = dict(self)
15+      d['content'] = FileDict.Omitted()
16+      return dict.__repr__(d)
17+    return dict.__repr__(self)
18+
19 class HttpRequest(object):
20     "A basic HTTP request"
21 
22@@ -86,11 +96,11 @@
23                 # IE submits the full path, so trim everything but the basename.
24                 # (We can't use os.path.basename because it expects Linux paths.)
25                 filename = name_dict['filename'][name_dict['filename'].rfind("\\")+1:]
26-                FILES.appendlist(name_dict['name'], {
27+                FILES.appendlist(name_dict['name'], FileDict({
28                     'filename': filename,
29                     'content-type': 'Content-Type' in submessage and submessage['Content-Type'] or None,
30                     'content': submessage.get_payload(),
31-                })
32+                }))
33             else:
34                 POST.appendlist(name_dict['name'], submessage.get_payload())
35     return POST, FILES