summaryrefslogtreecommitdiffstats
path: root/Lib/encodings/__init__.py
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2002-02-11 17:43:46 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2002-02-11 17:43:46 (GMT)
commita0af63b2421916e748700c746e03f1bd1656b074 (patch)
treef54da661f32748c2b9502bec620eacb4632f78f2 /Lib/encodings/__init__.py
parentf2f219daa249df3006666c81cb570aeb07724574 (diff)
downloadcpython-a0af63b2421916e748700c746e03f1bd1656b074.zip
cpython-a0af63b2421916e748700c746e03f1bd1656b074.tar.gz
cpython-a0af63b2421916e748700c746e03f1bd1656b074.tar.bz2
Corrected import behaviour for codecs which live outside the encodings
package.
Diffstat (limited to 'Lib/encodings/__init__.py')
-rw-r--r--Lib/encodings/__init__.py19
1 files changed, 7 insertions, 12 deletions
diff --git a/Lib/encodings/__init__.py b/Lib/encodings/__init__.py
index 65f5c9c..827db35 100644
--- a/Lib/encodings/__init__.py
+++ b/Lib/encodings/__init__.py
@@ -4,8 +4,8 @@
directory.
Codec modules must have names corresponding to standard lower-case
- encoding names with hyphens and periods mapped to underscores,
- e.g. 'utf-8' is implemented by the module 'utf_8.py'.
+ encoding names with hyphens mapped to underscores, e.g. 'utf-8' is
+ implemented by the module 'utf_8.py'.
Each codec module must export the following interface:
@@ -52,23 +52,18 @@ def search_function(encoding):
# default import module lookup scheme with the alias name.
#
modname = encoding.replace('-', '_')
- modname = modname.replace('.', '_')
try:
mod = __import__('encodings.' + modname,
globals(), locals(), _import_tail)
except ImportError,why:
import aliases
- modname = aliases.aliases.get(modname, _unknown)
- if modname is not _unknown:
- try:
- mod = __import__(modname,
- globals(), locals(), _import_tail)
- except ImportError,why:
- mod = None
- else:
+ modname = aliases.aliases.get(modname, modname)
+ try:
+ mod = __import__(modname, globals(), locals(), _import_tail)
+ except ImportError,why:
mod = None
if mod is None:
- # cache misses
+ # Cache misses
_cache[encoding] = None
return None