On Thu, 2007-06-21 at 04:49 +0000, Michael wrote:
> 
> 
> On May 11, 7:25 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
> > No. Prior to 1.0 we are going to remove the implicit and automatic
> > aliasing ofgettext() to _() throughout the code anyway. It's a bit of a
> > Python design wart -- i.e. they *really* didn't think it through. The
> > problem is that if you rely on the it always being in builtins, doctests
> > (and interactive shell work) break. In fact, I'm pretty sure that's
> > somewhat the cause of the problem you're seeing. Remember that _ is used
> > as "the last result" in the Python interactive prompt.
> >
> > So we have an open ticket (#2920) to remove it everywhere in our
> > internal code and not install it in builtins. People will need to import
> > it explicitly, which will also force them to think about whether they
> > really meangettext() or gettext_lazy().
> 
> It seems that the implicit use of _() within the Django's current
> admin interface is breaking unit tests for my own views (I'm guessing
> from the errors below that its related to the use of the {% url url-
> name %} tag). Error shown below. Note that if I add:
> 
> from django.utils.translation import gettext as _
> 
> to the relevant admin file (in this case, contrib/admin/views.doc.py)
> then the tests run as per normal. Everything is fine through a browser
> on the test server.
> 
> Does anyone know if there's another way to fix this without modifying
> the trunk django checkout (as obviously all the tests break when
> someone else runs them with a fresh checkout of django).
That's the recommended fix at the moment.

Once the unicode branch is merged into trunk (probably as part of the
merge), we will remove _() from automatic installation into builtins
altogether. It doesn't really make sense to default to gettext() in a
unicode world and developers should be thinking about whether they
should be using ugettext or gettext or ugettext_lazy or some other
method -- one version isn't always correct. It will also fix problems at
the interactive prompt (where _ is overloaded) and in doctests (for the
same reason)

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to