diff options
author | Fred Drake <fdrake@acm.org> | 2000-02-10 17:17:14 +0000 |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-02-10 17:17:14 +0000 |
commit | 13a2c279c504ae58c20baba5f0b3d1d6c0a85ed3 (patch) | |
tree | 6942aa091af39fe239eff68b0bf1292eea26da29 /Lib/mimetypes.py | |
parent | 857c4c36b962c6e74559e045c7fb43177dd5bcea (diff) | |
download | cpython-git-13a2c279c504ae58c20baba5f0b3d1d6c0a85ed3.tar.gz |
Untabify to pass the -tt test.
Diffstat (limited to 'Lib/mimetypes.py')
-rw-r--r-- | Lib/mimetypes.py | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py index cbc060b1f5..9dc3645fd0 100644 --- a/Lib/mimetypes.py +++ b/Lib/mimetypes.py @@ -30,8 +30,8 @@ import urllib knownfiles = [ "/usr/local/etc/httpd/conf/mime.types", "/usr/local/lib/netscape/mime.types", - "/usr/local/etc/httpd/conf/mime.types", # Apache 1.2 - "/usr/local/etc/mime.types", # Apache 1.3 + "/usr/local/etc/httpd/conf/mime.types", # Apache 1.2 + "/usr/local/etc/mime.types", # Apache 1.3 ] inited = 0 @@ -56,24 +56,24 @@ def guess_type(url): init() scheme, url = urllib.splittype(url) if scheme == 'data': - # syntax of data URLs: - # dataurl := "data:" [ mediatype ] [ ";base64" ] "," data - # mediatype := [ type "/" subtype ] *( ";" parameter ) - # data := *urlchar - # parameter := attribute "=" value - # type/subtype defaults to "text/plain" - comma = string.find(url, ',') - if comma < 0: - # bad data URL - return None, None - semi = string.find(url, ';', 0, comma) - if semi >= 0: - type = url[:semi] - else: - type = url[:comma] - if '=' in type or '/' not in type: - type = 'text/plain' - return type, None # never compressed, so encoding is None + # syntax of data URLs: + # dataurl := "data:" [ mediatype ] [ ";base64" ] "," data + # mediatype := [ type "/" subtype ] *( ";" parameter ) + # data := *urlchar + # parameter := attribute "=" value + # type/subtype defaults to "text/plain" + comma = string.find(url, ',') + if comma < 0: + # bad data URL + return None, None + semi = string.find(url, ';', 0, comma) + if semi >= 0: + type = url[:semi] + else: + type = url[:comma] + if '=' in type or '/' not in type: + type = 'text/plain' + return type, None # never compressed, so encoding is None base, ext = posixpath.splitext(url) while suffix_map.has_key(ext): base, ext = posixpath.splitext(base + suffix_map[ext]) |