mercurial/archival.py
changeset 2168 dd4ec4576cc8
parent 2112 2b03c6733efa
child 2169 4564794b6f55
--- a/mercurial/archival.py	Sun Apr 30 21:11:22 2006 +0200
+++ b/mercurial/archival.py	Sun Apr 30 22:43:41 2006 +0200
@@ -80,8 +80,13 @@
 
     def __init__(self, dest, prefix, compress=True):
         self.prefix = tidyprefix(dest, prefix, ('.zip',))
-        if not isinstance(dest, str) and not hasattr(dest, 'tell'):
-            dest = tellable(dest)
+        if not isinstance(dest, str):
+            try:
+                dest.tell()
+            except AttributeError:
+                dest = tellable(dest)
+            except IOError:
+                dest = tellable(dest)
         self.z = zipfile.ZipFile(dest, 'w',
                                  compress and zipfile.ZIP_DEFLATED or
                                  zipfile.ZIP_STORED)