From fe5da620b230b29e8fb6e8e8f28c9d50947f828d Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 1 Jun 2008 18:08:10 +0200 Subject: [PATCH] display gzip errors --- oxdbarchive/model.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/oxdbarchive/model.py b/oxdbarchive/model.py index 4fd493e..a81ab7e 100644 --- a/oxdbarchive/model.py +++ b/oxdbarchive/model.py @@ -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()