Mercurial > hg
comparison mercurial/byterange.py @ 8378:59acf64995d2
byterange: fix import error
We must import the module as email.Utils on case-sensitive
filesystems.
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Thu, 14 May 2009 13:20:04 +0200 |
parents | 0bf0045000b5 |
children | 8429062de8d3 |
comparison
equal
deleted
inserted
replaced
8377:29f4f0d66cd5 | 8378:59acf64995d2 |
---|---|
21 | 21 |
22 import os | 22 import os |
23 import stat | 23 import stat |
24 import urllib | 24 import urllib |
25 import urllib2 | 25 import urllib2 |
26 import email.utils | 26 import email.Utils |
27 | 27 |
28 try: | 28 try: |
29 from cStringIO import StringIO | 29 from cStringIO import StringIO |
30 except ImportError, msg: | 30 except ImportError, msg: |
31 from StringIO import StringIO | 31 from StringIO import StringIO |
212 host = req.get_host() | 212 host = req.get_host() |
213 file = req.get_selector() | 213 file = req.get_selector() |
214 localfile = urllib.url2pathname(file) | 214 localfile = urllib.url2pathname(file) |
215 stats = os.stat(localfile) | 215 stats = os.stat(localfile) |
216 size = stats[stat.ST_SIZE] | 216 size = stats[stat.ST_SIZE] |
217 modified = email.utils.formatdate(stats[stat.ST_MTIME]) | 217 modified = email.Utils.formatdate(stats[stat.ST_MTIME]) |
218 mtype = mimetypes.guess_type(file)[0] | 218 mtype = mimetypes.guess_type(file)[0] |
219 if host: | 219 if host: |
220 host, port = urllib.splitport(host) | 220 host, port = urllib.splitport(host) |
221 if port or socket.gethostbyname(host) not in self.get_names(): | 221 if port or socket.gethostbyname(host) not in self.get_names(): |
222 raise urllib2.URLError('file not on local host') | 222 raise urllib2.URLError('file not on local host') |