Andres Salomon wrote:
> Andres Salomon wrote:
> [...]
> 
>> Trac [/usr/local/foo]> component list
>>
>> Command failed: unknown encoding: en_gb
>>
>> Are others seeing this, or is my bastardized sarge+bpo setup somehow
>> broken?  This is straight trunk, w/ no mysql patches or anything.
> 
>

Ah-ha, I think this is a python2.3 bug.  From gvr's source[0]:

        # FIX locale.py LANGUAGE parsing bug, the fix was added on the
        # upstream CVS on the 1.28.4.2 revision of 'locale.py', It
        # should be included on Python 2.4.2.

I tried the same thing (getdefaultlocale()) on a python2.4/ubuntu
machine, and it worked.  Of course:

17:26 < sto> dilinger: if you want the encoding shouldn't it be get using
             locale.getpreferredencoding()?
17:27 < sto> dilinger: The locale name has nothing to do with the
encoding, no?

>>> locale.getdefaultlocale()
['en_US', 'en_gb']
>>> locale.getpreferredencoding()
'ISO-8859-1'
>>>


I think he's right, and getpreferredencoding() seems to work on both as
well.  As cons_locale isn't used at all, I dropped it.  After applying
the attached patch, all unit tests succeeded.


[0]
http://cvs.sourceforge.net/viewcvs.py/gvr/GvR/utils.py?rev=1.31&view=auto
=== modified file 'trac/scripts/admin.py'
--- trac/scripts/admin.py	
+++ trac/scripts/admin.py	
@@ -172,7 +172,7 @@
         return [a for a in words if a.startswith (text)]
 
     def print_listing(self, headers, data, sep=' ', decor=True):
-        (cons_locale, cons_charset) = locale.getdefaultlocale() 
+        cons_charset = locale.getpreferredencoding() 
         ldata = list(data)
         if decor:
             ldata.insert(0, headers)

_______________________________________________
Trac-dev mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-dev

Reply via email to