From: Stephen G. <ste...@op...> - 2009-02-19 04:05:36
Attachments:
GrampsLocale.patch
|
I am unsure as I've never worked with locales before, so I'd like someone to scrutinise what I'm saying I *think* I found a bug in _GrampsLocale.py, which is causing week day names to be wrong in WebCal Of course this bug only affects OS's that do not support locale.nl_langinfo() ... think windows. It seems to me that the order you load the lists 'long_days' & 'short_days' in _GrampsLocale.py is different when the os supports nl_langinfo and when it doesn't. I've attached a patch, this patch fixes the WebCal issue (for me in Australia running windows) http://www.gramps-project.org/bugs/view.php?id=2722 (I don't know if there are any other issues in _GrampsLocale.py) I hope someone can make sense of this information. Thanks for the review Steve |
From: Benny M. <ben...@gm...> - 2009-02-19 08:15:05
|
Very good catch. Attach the patch to the bug item, it looks good to me. I do find it strange that passing a 7 does not crash this function, as they state in the doc the range is 0-6. Benny 2009/2/19 Stephen George <ste...@op...> > > I am unsure as I've never worked with locales before, so I'd like someone > to scrutinise what I'm saying > > I *think* I found a bug in _GrampsLocale.py, which is causing week day > names to be wrong in WebCal > > Of course this bug only affects OS's that do not support > locale.nl_langinfo() ... think windows. > > It seems to me that the order you load the lists 'long_days' & 'short_days' > in _GrampsLocale.py is different when the os supports nl_langinfo and when > it doesn't. > > I've attached a patch, this patch fixes the WebCal issue (for me in > Australia running windows) > http://www.gramps-project.org/bugs/view.php?id=2722 > > (I don't know if there are any other issues in _GrampsLocale.py) > > I hope someone can make sense of this information. > Thanks for the review > > Steve > > Index: src/GrampsLocale/_GrampsLocale.py > =================================================================== > --- src/GrampsLocale/_GrampsLocale.py (revision 12029) > +++ src/GrampsLocale/_GrampsLocale.py (working copy) > @@ -95,15 +95,17 @@ > unicode(locale.nl_langinfo(locale.ABMON_12),codeset), > ) > > + # DAY_1 ... DAY_7 - follows the US convention of DAY_1 being Sunday > + # see http://docs.python.org/library/locale.html#module-locale > long_days = ( > "", > - unicode(locale.nl_langinfo(locale.DAY_1),codeset), > - unicode(locale.nl_langinfo(locale.DAY_2),codeset), > - unicode(locale.nl_langinfo(locale.DAY_3),codeset), > - unicode(locale.nl_langinfo(locale.DAY_4),codeset), > - unicode(locale.nl_langinfo(locale.DAY_5),codeset), > - unicode(locale.nl_langinfo(locale.DAY_6),codeset), > - unicode(locale.nl_langinfo(locale.DAY_7),codeset), > + unicode(locale.nl_langinfo(locale.DAY_1),codeset), #Sunday > + unicode(locale.nl_langinfo(locale.DAY_2),codeset), #Monday > + unicode(locale.nl_langinfo(locale.DAY_3),codeset), #Tuesday > + unicode(locale.nl_langinfo(locale.DAY_4),codeset), #Wednesday > + unicode(locale.nl_langinfo(locale.DAY_5),codeset), #Thurday > + unicode(locale.nl_langinfo(locale.DAY_6),codeset), #Friday > + unicode(locale.nl_langinfo(locale.DAY_7),codeset), #Saturday > ) > > short_days = ( > @@ -183,27 +185,40 @@ > unicode(time.strftime('%b',(0,12,1,1,1,1,1,1,1)),codeset), > ) > > +# Index Attribute Values > +# > +# 0 tm_year (for example, 1993) > +# 1 tm_mon range [1,12] > +# 2 tm_mday range [1,31] > +# 3 tm_hour range [0,23] > +# 4 tm_min range [0,59] > +# 5 tm_sec range [0,61]; see (1) in strftime() description > +# 6 tm_wday range [0,6], Monday is 0 > +# 7 tm_yday range [1,366] > +# 8 tm_isdst 0, 1 or -1; see below > + > +#see http://docs.python.org/library/time.html#module-time > long_days = ( > "", > - unicode(time.strftime('%A',(0,1,1,1,1,1,1,1,1)),codeset), > - unicode(time.strftime('%A',(0,1,1,1,1,1,2,1,1)),codeset), > - unicode(time.strftime('%A',(0,1,1,1,1,1,3,1,1)),codeset), > - unicode(time.strftime('%A',(0,1,1,1,1,1,4,1,1)),codeset), > - unicode(time.strftime('%A',(0,1,1,1,1,1,5,1,1)),codeset), > - unicode(time.strftime('%A',(0,1,1,1,1,1,6,1,1)),codeset), > - unicode(time.strftime('%A',(0,1,1,1,1,1,7,1,1)),codeset), > + unicode(time.strftime('%A',(0,1,1,1,1,1,6,1,1)),codeset), #Sunday > + unicode(time.strftime('%A',(0,1,1,1,1,1,0,1,1)),codeset), #Monday > + unicode(time.strftime('%A',(0,1,1,1,1,1,1,1,1)),codeset), #Tuesday > + unicode(time.strftime('%A',(0,1,1,1,1,1,2,1,1)),codeset), > #Wednesday > + unicode(time.strftime('%A',(0,1,1,1,1,1,3,1,1)),codeset), > #Thursday > + unicode(time.strftime('%A',(0,1,1,1,1,1,4,1,1)),codeset), #Friday > + unicode(time.strftime('%A',(0,1,1,1,1,1,5,1,1)),codeset), > #Saturday > ) > > short_days = ( > "", > - unicode(time.strftime('%a',(0,1,1,1,1,1,1,1,1)),codeset), > - unicode(time.strftime('%a',(0,1,1,1,1,1,2,1,1)),codeset), > - unicode(time.strftime('%a',(0,1,1,1,1,1,3,1,1)),codeset), > - unicode(time.strftime('%a',(0,1,1,1,1,1,4,1,1)),codeset), > - unicode(time.strftime('%a',(0,1,1,1,1,1,5,1,1)),codeset), > - unicode(time.strftime('%a',(0,1,1,1,1,1,6,1,1)),codeset), > - unicode(time.strftime('%a',(0,1,1,1,1,1,7,1,1)),codeset), > - ) > + unicode(time.strftime('%a',(0,1,1,1,1,1,6,1,1)),codeset), #Sunday > + unicode(time.strftime('%a',(0,1,1,1,1,1,0,1,1)),codeset), #Monday > + unicode(time.strftime('%a',(0,1,1,1,1,1,1,1,1)),codeset), #Tuesday > + unicode(time.strftime('%a',(0,1,1,1,1,1,2,1,1)),codeset), > #Wednesday > + unicode(time.strftime('%a',(0,1,1,1,1,1,3,1,1)),codeset), > #Thursday > + unicode(time.strftime('%a',(0,1,1,1,1,1,4,1,1)),codeset), #Friday > + unicode(time.strftime('%a',(0,1,1,1,1,1,5,1,1)),codeset), > #Saturday > + ) > > if time.strftime('%x',(2005,1,2,1,1,1,1,1,1)) == '2/1/2005': > tformat = '%d/%m/%y' > > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, > CA > -OSBC tackles the biggest issue in open source: Open Sourcing the > Enterprise > -Strategies to boost innovation and cut costs with open source > participation > -Receive a $600 discount off the registration fee with the source code: > SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Gramps-devel mailing list > Gra...@li... > https://lists.sourceforge.net/lists/listinfo/gramps-devel > > |