display gzip errors

This commit is contained in:
j 2008-06-01 18:08:10 +02:00
parent f56aab091e
commit fe5da620b2

View file

@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
# -*- Mode: Python; -*-
# vi:si:et:sw=2:sts=2:ts=2
import gzip
import StringIO
from sqlobject import *
from turbogears.database import PackageHub
@ -58,8 +60,11 @@ class Archive(SQLObject):
try:
result = getUrl(url)
except urllib2.HTTPError, e:
print e.code
print e.read()
print "ERROR:", e.code
data = e.read()
if e.headers.get('content-encoding', None) == 'gzip':
data = gzip.GzipFile(fileobj=StringIO.StringIO(data)).read()
print data
raise
except:
import traceback
@ -199,7 +204,7 @@ class Archive(SQLObject):
- sync get list from frontend and remove/add those that are not in sync
'''
def updateFrontend(self):
for f in ArchiveFile.select(ArchiveFile.modified >= self.published):
for f in ArchiveFile.select(ArchiveFile.q.published >= self.published):
self.notifyFrontend('add', f.md5sum)
self.published=datetime.now()