Ticket #4947: 1.diff

File 1.diff, 1.3 KB (added by eibaan@…, 17 years ago)
  • __init__.py

     
    1616class Http404(Exception):
    1717    pass
    1818
     19class 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
    1929class HttpRequest(object):
    2030    "A basic HTTP request"
    2131
     
    8696                # IE submits the full path, so trim everything but the basename.
    8797                # (We can't use os.path.basename because it expects Linux paths.)
    8898                filename = name_dict['filename'][name_dict['filename'].rfind("\\")+1:]
    89                 FILES.appendlist(name_dict['name'], {
     99                FILES.appendlist(name_dict['name'], FileDict({
    90100                    'filename': filename,
    91101                    'content-type': 'Content-Type' in submessage and submessage['Content-Type'] or None,
    92102                    'content': submessage.get_payload(),
    93                 })
     103                }))
    94104            else:
    95105                POST.appendlist(name_dict['name'], submessage.get_payload())
    96106    return POST, FILES
Back to Top