From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QmYfM-00015S-Cw for garchives@archives.gentoo.org; Thu, 28 Jul 2011 22:02:52 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 07C5021C5E7 for ; Thu, 28 Jul 2011 22:02:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 9020421C5CF for ; Thu, 28 Jul 2011 21:33:04 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9BDF71B401E for ; Thu, 28 Jul 2011 21:33:03 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id EE60C8003D for ; Thu, 28 Jul 2011 21:33:02 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: Subject: [gentoo-commits] proj/layman:master commit in: layman/ X-VCS-Repository: proj/layman X-VCS-Files: layman/db.py X-VCS-Directories: layman/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: b08a5e4b34e0258e84714bcef16c1d5d09c71b39 Date: Thu, 28 Jul 2011 21:33:02 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: e7e1a242d2832afb7cdaed9768f57856 commit: b08a5e4b34e0258e84714bcef16c1d5d09c71b39 Author: dol-sen gmail com> AuthorDate: Thu Jul 28 21:29:12 2011 +0000 Commit: Brian Dolbec gmail com> CommitDate: Thu Jul 28 21:29:12 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/layman.git;a=3D= commit;h=3Db08a5e4b fix setting the timestamp from the remote server, bug # 376601. --- layman/db.py | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) diff --git a/layman/db.py b/layman/db.py index bb6fd81..64b54ce 100644 --- a/layman/db.py +++ b/layman/db.py @@ -319,7 +319,12 @@ class RemoteDB(DbBase): =20 try: connection =3D opener.open(request) - timestamp =3D connection.headers['last-modified'] + if 'last-modified' in connection.headers.keys(): + timestamp =3D connection.headers['last-modified'] + elif 'date' in connection.headers.keys(): + timestamp =3D connection.headers['date'] + else: + timestamp =3D None except urllib2.HTTPError as e: if e.getcode() =3D=3D 304: self.output.info('Remote list already up to date: %s= ' @@ -330,15 +335,16 @@ class RemoteDB(DbBase): % str(e)) continue except IOError as error: - self.output.warn('Failed to update the overlay list from= : ' - + url + '\nError was:\n' + str(error)) + self.output.warn('RemoteDB.cache(); Failed to update the= overlay list from: ' + + url + '\nIOError was:\n' + str(error)) else: if url.startswith('file://'): quieter =3D 1 else: quieter =3D 0 self.output.info('Fetching new list... %s' % url, 4 + qu= ieter) - self.output.info('Last-modified: %s' % timestamp, 4 + qu= ieter) + if timestamp is not None: + self.output.info('Last-modified: %s' % timestamp, 4 = + quieter) # Fetch the remote list olist =3D connection.read() =20 @@ -368,9 +374,10 @@ class RemoteDB(DbBase): out_file.write(olist) out_file.close() =20 - out_file =3D open(tpath, 'w') - out_file.write(timestamp) - out_file.close() + if timestamp is not None: + out_file =3D open(tpath, 'w') + out_file.write(str(timestamp)) + out_file.close() =20 has_updates =3D True =20