[Yum-devel][PATCH] locale related traceback

Menno Smits menno-yum at freshfoo.com
Wed Jun 8 22:12:07 UTC 2005


Terje Rosten wrote:
> 
> ===================================================================
> RCS file: /cvsroot/yum/cvs/yum/output.py,v
> retrieving revision 1.59
> diff -u -r1.59 output.py
> --- output.py	3 Jun 2005 21:21:08 -0000	1.59
> +++ output.py	8 Jun 2005 08:09:25 -0000
> @@ -21,7 +21,6 @@
>  import os.path
>  import sys
>  import time
> -import locale
>  from i18n import _
>  
>  from urlgrabber.progress import TextMeter
> @@ -36,9 +35,11 @@
>  class YumOutput:
>  
>      def printtime(self):
> -        locale.setlocale(locale.LC_TIME, 'C')
> -        ret = time.strftime('%b %d %H:%M:%S ', time.localtime(time.time()))
> -        locale.resetlocale(locale.LC_TIME)
> +        months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
> +                  'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
> +        now = time.localtime(time.time())
> +        ret = months[int(time.strftime('%m', now)) - 1] + \
> +              time.strftime(' %d %T ', now)
>          return ret

This patch fixes the problem for me. Seth, should we be commiting this? 
Its obviously not Python 2.3 dependent.

Menno



More information about the Yum-devel mailing list