Revision: 8056
          http://svn.sourceforge.net/mailman/?rev=8056&view=rev
Author:   tkikuchi
Date:     2006-10-11 17:48:48 -0700 (Wed, 11 Oct 2006)

Log Message:
-----------
With python2.5, importing JapaneseCodecs triggers LookupError because
'iso2022_jp' does not exist in japanese (but 'iso_2022_jp').
We try to test Japanese (and Korean) codecs before changing path order
and do not import japanese/korean if the codecs already exist in python
distribution. (as in 2.4 and 2.5) Importing japanese/korean is going away
in mailman-2.2.

Modified Paths:
--------------
    branches/Release_2_1-maint/mailman/misc/paths.py.in

Modified: branches/Release_2_1-maint/mailman/misc/paths.py.in
===================================================================
--- branches/Release_2_1-maint/mailman/misc/paths.py.in 2006-10-11 16:51:15 UTC 
(rev 8055)
+++ branches/Release_2_1-maint/mailman/misc/paths.py.in 2006-10-12 00:48:48 UTC 
(rev 8056)
@@ -35,6 +35,19 @@
 if exec_prefix == '${prefix}':
     exec_prefix = prefix
 
+# Check if ja/ko codecs are available before changing path.
+try:
+    s = unicode('OK', 'iso-2022-jp')
+    jaok = True
+except LookupError:
+    jaok = False
+
+try:
+    s = unicode('OK', 'euc-kr')
+    kook = True
+except LookupError:
+    kook = False
+
 # Hack the path to include the parent directory of the $prefix/Mailman package
 # directory.
 sys.path.insert(0, prefix)
@@ -53,12 +66,14 @@
 # In a normal interactive Python environment, the japanese.pth and korean.pth
 # files would be imported automatically.  But because we inhibit the importing
 # of the site module, we need to be explicit about importing these codecs.
-import japanese
+if not jaok:
+    import japanese
 # As of KoreanCodecs 2.0.5, you had to do the second import to get the Korean
 # codecs installed, however leave the first import in there in case an upgrade
 # changes this.
-import korean
-import korean.aliases
+if not kook:
+    import korean
+    import korean.aliases
 # Arabic and Hebrew (RFC-1556) encoding aliases. (temporary solution)
 import encodings.aliases
 encodings.aliases.aliases.update({


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to