[PATCH 1/2] A function for resolving date format and order

Brian C. Lane bcl at redhat.com
Wed Oct 8 15:47:59 UTC 2014


On Wed, Oct 08, 2014 at 09:03:31AM +0200, Vratislav Podzimek wrote:
> On Tue, 2014-10-07 at 17:42 -0400, Anne Mulhern wrote:
> > 
> > 
> > 
> > ----- Original Message -----
> > > From: "Brian C. Lane" <bcl at redhat.com>
> > > To: anaconda-patches at lists.fedorahosted.org
> > > Sent: Tuesday, October 7, 2014 4:40:18 PM
> > > Subject: Re: [PATCH 1/2] A function for resolving date format and order
> > > 
> > > On Tue, Oct 07, 2014 at 06:32:36PM +0200, Vratislav Podzimek wrote:
> > > > It's not that easy to get right order of date fields (year, month, day) and
> > > > their formats so we should better have it in a standalone function with
> > > > tests.
> > > > 
> > > > Related: rhbz#1044233
> > > > Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> > > > ---
> > 
> > <-- SNIP -->
> > 
> > > > +
> > > > +    order = []
> > > > +    formats = []
> > > > +    fmt_str = locale_mod.nl_langinfo(locale_mod.D_FMT)
> > > 
> > > Is it possible for this to return None or something without %? If so
> > > then we should catch that and default to something 'normal'.
> > 
> > From the docs it seems more likely that nl_langinfo() or D_FMT might be undefined,
> > or that nl_langinfo() would fail to recognize its argument.
> > 
> > So, it might make sense to catch AttributeError and ValueError when getting fmt_str
> > and then set it to some default.
> That's what I was trying to avoid and leave it to the tests that test
> all the locales available in the system accepted by 'locale.setlocale'.
> I we default to something, those tests will just pass. I think we
> shouldn't cover such significant issues in tools/libraries we use.

I do like the idea of the tests checking everything, but what I'm worried
about is runtime crashes when things are different from the test
environment. Ideally we'd be able to catch both.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)


More information about the anaconda-patches mailing list