List Info

Thread: SetEnv LC_TIME




SetEnv LC_TIME
user name
2007-10-23 11:07:15
Does the following documentation section still apply:

http://trac.ed
gewall.org/wiki/TracFaq#how-do-i-change-the-format-used-for-
displaying-date-and-time
?

It does not work for a ModPython-based setup - TracLocale
needs to be
used, but I wondering if it works at all:

Trac/trunk never uses LC_TIME, except for retrieving the
encoding
charset in datefmt.py:110, but looking at the result of the
following
code snippet:

$ LC_TIME="en_GB.UTF-8" python
Python 2.4.4 .. on linux2
>>> import locale
>>> locale.getlocale(locale.LC_TIME)
(None, None)

It does not seem locale is able to use the environment
variable.

Now back at the initial question, the following code
snippet:

eblotfirmware:/etc/cron.d$ LC_TIME="en_GB.UTF-8"
python
Python 2.4.4 .. on linux2
>>> import os
>>> import locale
>>> import time
>>> os.environ['LC_TIME']
'en_GB.UTF-8'
>>> time.strftime("%x %X",
time.gmtime(time.time()))
'10/23/07 15:52:27'
>>> locale.setlocale(locale.LC_TIME,
os.environ['LC_TIME'])
'en_GB.UTF-8'
>>> time.strftime("%x %X",
time.gmtime(time.time()))
'23/10/07 15:52:52'

It seems that till locale is not explictly defined in
Python,
localized time is not used - in other word Python does not
seem to use
the LC_TIME env. var. at all.

Is my Python bugged, or did I miss something obvious?

Cheers,
Manu

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Trac Development" group.
To post to this group, send email to trac-devgooglegroups.com
To unsubscribe from this group, send email to
trac-dev-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )