Ticket #4947: 1.diff
File 1.diff, 1.3 KB (added by , 17 years ago) |
---|
-
__init__.py
16 16 class Http404(Exception): 17 17 pass 18 18 19 class FileDict(dict): 20 class Omitted: 21 def __repr__(self): return "<omitted>" 22 def __repr__(self): 23 if 'content' in self: 24 d = dict(self) 25 d['content'] = FileDict.Omitted() 26 return dict.__repr__(d) 27 return dict.__repr__(self) 28 19 29 class HttpRequest(object): 20 30 "A basic HTTP request" 21 31 … … 86 96 # IE submits the full path, so trim everything but the basename. 87 97 # (We can't use os.path.basename because it expects Linux paths.) 88 98 filename = name_dict['filename'][name_dict['filename'].rfind("\\")+1:] 89 FILES.appendlist(name_dict['name'], {99 FILES.appendlist(name_dict['name'], FileDict({ 90 100 'filename': filename, 91 101 'content-type': 'Content-Type' in submessage and submessage['Content-Type'] or None, 92 102 'content': submessage.get_payload(), 93 }) 103 })) 94 104 else: 95 105 POST.appendlist(name_dict['name'], submessage.get_payload()) 96 106 return POST, FILES