Commits

Martin von Löwis  committed fa6596a

Try decompressing simple pages from store; fall back to assuming
that it is uncompressed. Clear blob reference when deleting a file.

  • Participants
  • Parent commits 2ce3d08

Comments (0)

Files changed (2)

         return None
     if r.status != 200:
         raise ValueError, "Status %d on %s" % (r.status, project)
+    html = zlib.compress(html)
     if obj:
-        obj.simple = zlib.compress(html)
+        obj.simple = html
     else:
         obj = model.Project(key_name=uproject, simple=html)
     if project:
                            etag=r.msg.get('etag'), secret=secret)
         else:
             f.contents.delete()
+            f.contents = None
             f.etag = r.msg.get('etag')
         f.put()
         # double-check it's a singleton
         path = path.rstrip('/')
         if not path:
             p = model.MirrorState.all().fetch(1)[0]
-            html = zlib.decompress(p.simple)
         elif '/' in path:
             return self.error(404)
         else:
                 self.response.set_status(404)
                 self.response.out.write("<html><head><title>404 Not Found</title></head><body>Package %s does not exist</body></html>" % path)
                 return
+        try:
+            html = zlib.decompress(p.simple)
+        except zlib.error:
+            # newer objects are stored compressed, older are not
             html = p.simple
         self.response.out.write(html)