1. Martin von Löwis
  2. pypi-appengine

Commits

Martin von Löwis  committed a716ebf

Make etag usage optional.

  • Participants
  • Parent commits 07143cb
  • Branches default

Comments (0)

Files changed (1)

File fetch.py

View file
         f = f[0]
     h = httplib.HTTPConnection('pypi.python.org')
     h.putrequest('HEAD', '/packages/'+urllib2.quote(path))
-    if f:
+    if f and f.etag:
         h.putheader("If-none-match", f.etag)
     h.endheaders()
     try:
             model.Directory.mkdir(parent)
             secret = binascii.b2a_hex(os.urandom(10))
             f = model.File(path=path, dotdot=parent, project=project,
-                           etag=r.msg['etag'], secret=secret)
+                           etag=r.msg.get('etag'), secret=secret)
         else:
             f.contents.delete()
-            f.etag = r.msg['etag']
+            f.etag = r.msg.get('etag')
         f.put()
         # double-check it's a singleton
         files = model.File.all().filter("path = ", path).fetch(10)