python-2.6: deprecation of GzipFile.filename
authorDirkjan Ochtman <dirkjan@ochtman.nl>
Tue, 08 Apr 2008 15:42:43 +0200
changeset 6495 3130c9ded04e
parent 6492 43d14cbd69b7
child 6496 118720f857b9
python-2.6: deprecation of GzipFile.filename
mercurial/archival.py
--- a/mercurial/archival.py	Mon Apr 07 13:16:11 2008 +0200
+++ b/mercurial/archival.py	Tue Apr 08 15:42:43 2008 +0200
@@ -52,7 +52,8 @@
         def _write_gzip_header(self):
             self.fileobj.write('\037\213')             # magic header
             self.fileobj.write('\010')                 # compression method
-            fname = self.filename[:-3]
+            # Python 2.6 deprecates self.filename
+            fname = getattr(self, 'name', None) or self.filename 
             flags = 0
             if fname:
                 flags = gzip.FNAME