summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2010-01-25 00:45:31 +0100
committerMiklos Vajna <vmiklos@frugalware.org>2010-01-25 00:45:31 +0100
commitc8588a40b0f9b5817f785e4e1294d3784da22eff (patch)
treec551e0654019d18480f2d3ec77c0863148c0968a
parent2cc9973fff3377f5f5a49733ce1e799410859eb7 (diff)
downloadpython-fastimport-c8588a40b0f9b5817f785e4e1294d3784da22eff.tar.gz
darcs-fast-export: don't use urllib.urlopen().getcode()
As it's missing from python2.5.
-rwxr-xr-xexporters/darcs/darcs-fast-export7
1 files changed, 6 insertions, 1 deletions
diff --git a/exporters/darcs/darcs-fast-export b/exporters/darcs/darcs-fast-export
index d8a04b0..4417bd4 100755
--- a/exporters/darcs/darcs-fast-export
+++ b/exporters/darcs/darcs-fast-export
@@ -34,6 +34,7 @@ import subprocess
import optparse
import re
import urllib
+import urllib2
import StringIO
sys = reload(sys)
@@ -154,7 +155,11 @@ class Handler:
if os.path.exists(path):
return True
else:
- return urllib.urlopen(path).getcode() == 200
+ try:
+ urllib2.urlopen(urllib2.Request(path))
+ return True
+ except urllib2.HTTPError, e:
+ return False
# this is like open, but supports urls as well
def open(self, path):