Commits

Hugo Lopes Tavares  committed 8cc0be3

the last bugfix was not complete - if urllib2.urlopen opens a file uri content, it has no "code" or "msg" attribute in addinfourl instance; added getattr for that

  • Participants
  • Parent commits 86b75db

Comments (0)

Files changed (1)

File tests/pypi_server.py

         fp = open(filepath, 'wb')
         # when it uses file:// scheme, code is None and there is no msg attr
         # but it has been successfully opened
-        status = '%s %s' % (response.code or 200, getattr(response, 'msg', 'OK'))
+        status = '%s %s' % (getattr(response, 'code', 200), getattr(response, 'msg', 'OK'))
         headers = ['%s: %s' % (key, value) for key, value in response.headers.items()]
         body = response.read()
         fp.write('\n'.join([status] + headers + ['', body]))