On Tue, May 06, 2008 at 07:38:07PM -0400, Luke Macken wrote:
> On Mon, May 05, 2008 at 04:20:05PM -0400, James Antill wrote:
> >
> > On Mon, 2008-05-05 at 15:53 -0400, Luke Macken wrote:
> > > Hey,
> > >
> > > So I recently ran into a problem with some test cases for another
> > > project, caused
> > > by yum overriding the builtin '_' and replacing it with the
> > > yum.i18n.dummy_wrapper.
> > > One of the libraries I am using then tried to pass a 'domain' argument to
> > > '_', thus triggering an exception, since the dummy_wrapper does not take
> > > any arguments.
> > >
> > > The yum.i18n module runs gettext.translation.install(), which ideally
> > > should only be used for applications[0], not modules[1].
> > >
> > > So, a potential solution would be to define '_' in the i18n module,
> > > by doing something like this:
> > >
> > > t = gettext.translation('yum', fallback=True)
> > > _ = t.ugettext
> > >
> > > And import '_' from it where necessary.
> > >
> > > What do you guys think?
> >
> > So that's how we had the code for a while, the big reason we changed
> > from that is that we wanted to be able to turn gettext off from within
> > the yum API (this was when unicode was causing _lots_ of problems, due
> > to stdout's error handler).
> > Assuming that:
> >
> > i18n._ = i18n.dummy_wrapper
> >
> > ...works[1] fine from within __init__.py ... I think it's fine to change
> > it back.
> > Oh, and also make sure that test/yum-release-i18n-test.sh works after
> > that change is installed on the running system ... just to be sure.
> >
> >
> > [1] Read: Changes what _() does for everything that's imported _ from
> > yum.i18n ... I'd guess this would happen, but I haven't tested it.
>
> Patch attached.
>
> All of the unit tests run fine, and the yum-release-i18n-test seemed to
> run without any explosions. 'gaftonmode' also works as well.
James said on IRC that the patch looked fine...
Applied in commit b675e137bf36fe161938b016ff36867305b432f2
luke
_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel