On Fri, 2007-05-25 at 17:17 +0200, Michael Radziej wrote:
> Hi Malcolm,
> 
> A short disclaimer: I'm currently trying the unicode branch with the 
> autoescape patch and a
> couple of other patches, so my problems might really be my own problems,
> but I don't expect it.
> 
> 
> First, I found that I have a problem with commit 5255 together with the test
> client. It breaks loading the modules, probably due to recursive imports.
> 
> - management activates translation
> - this loads all apps
> - One of my apps loads the test Client (I'm use a different testing
>     framework that uses the django test client)
> - test client loads contrib.session
> - the model meta class starts translation in contribute_to_class
> - this loads all apps --> doesn't work
> 
> I moved the import statement in my app into the function --> works.
> 
> I suggest to change the test client so that it imports other models
> only in a function and not at compile time. 

I'd rather try and fix the root problem first, since having to order
your code in a particular way to avoid import problems is fragile.
Certainly needs to be looked at, though. Will do.
> 
> -*-
> 
> Second, I have a map of view tags, verbose names for these and how to build
> the url (it was born before the regex reverser). This map uses gettext_lazy
> for the verbose names, which is used later with the % operator. This fails
> because 
> 
> In [44]: "%s" % gettext_lazy("Dienste")
> Out[44]: '<django.utils.functional.__proxy__ object at 0xb70dacac>'

This is an issue in lazy() that is very hard to fix, because __str__ is
used for so many things in Python, I'm not going to call it a bug; it's
just unbelievably annoying.

> 
> With proper unicode objects, though, it works:
> 
> In [45]: u"%s" % ugettext_lazy("Dienste")
> Out[45]: u'Services'
> 
> (It really requires both that the pattern is unicode and that ugettext_lazy is
> used and not gettext_lazy)
> 
> I'm now working to work around this, but it's a lot of replacements from
> "gettext_lazy" --> "ugettext_lazy" and also to promote all the patterns to
> unicode. 

I'll have a look at this. Commit 5239 is absolutely required.. I think
we may need to make a Promise-variant for translations only so that we
can make __str__ work properly for them, too (we can't do it in general,
because their are non-translation-related places where lazy() is used
and I don't want to break __str__ for them).

I don't feel too bad about people have to move gettext_lazy to
ugettext_lazy (it's the 21st century, global search and replace has
existed for 30 years), but the promotion to unicode strings can take a
few minutes, agreed.

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