On Sun, Jan 18, 2004 at 10:24:12PM +0100, "Martin v. L?wis" wrote: > > I also find that installing JapaneseCodecs on top of a CJK-enabled > Python 2.4 causes shift_jis to use the CJK codec, not the japanese > codec. > Aah. We need to change codec lookup order of encodings.search_function to enable to override default codec by 3rd party one. With attached patch, I could get JapaneseCodecs's one. Now, I admit that CJK codecs are obviously un-backportable to 2.3 due to this change. ;-) Hye-Shik -------------- next part -------------- *** __init__.py.orig Mon Jan 19 06:49:27 2004 --- __init__.py Mon Jan 19 06:46:16 2004 *************** *** 28,33 **** --- 28,34 ---- """#" import codecs, exceptions, types + import aliases _cache = {} _unknown = '--unknown--' *************** *** 74,96 **** # Import the module: # ! # First look in the encodings package, then try to lookup the ! # encoding in the aliases mapping and retry the import using the ! # default import module lookup scheme with the alias name. # modname = normalize_encoding(encoding) ! try: ! mod = __import__('encodings.' + modname, ! globals(), locals(), _import_tail) ! except ImportError: ! import aliases ! modname = (aliases.aliases.get(modname) or ! aliases.aliases.get(modname.replace('.', '_')) or ! modname) try: ! mod = __import__(modname, globals(), locals(), _import_tail) except ImportError: mod = None try: getregentry = mod.getregentry --- 75,97 ---- # Import the module: # ! # First lookup the encoding in the aliases mapping and try the ! # import using the default import module lookup scheme with the ! # alias name if available. Then look in the encodings package. # modname = normalize_encoding(encoding) ! modnamestry = ['encodings.' + modname] ! aliasedname = (aliases.aliases.get(modname) or ! aliases.aliases.get(modname.replace('.', '_'))) ! if aliasedname is not None: ! modnamestry.insert(0, aliasedname) ! for mn in modnamestry: try: ! mod = __import__(mn, globals(), locals(), _import_tail) except ImportError: mod = None + else: + break try: getregentry = mod.getregentry *************** *** 125,131 **** except AttributeError: pass else: - import aliases for alias in codecaliases: if not aliases.aliases.has_key(alias): aliases.aliases[alias] = modname --- 126,131 ----
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4