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. 

-*-

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>'

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 wonder, can this be changed so that it works the old way, too? This seems
to be related with commit 5239:


@@ -32,6 +32,8 @@ def lazy(func, *resultclasses):
                 self.__dispatch[resultclass] = {}
                 for (k, v) in resultclass.__dict__.items():
                     setattr(self, k, self.__promise__(resultclass, k, v))
+            if unicode in resultclasses:
+                setattr(self, '__unicode__', self.__unicode_cast)
 
         def __promise__(self, klass, funcname, func):
             # Builds a wrapper around some magic method and registers that
magic
@@ -47,6 +49,9 @@ def lazy(func, *resultclasses):
             self.__dispatch[klass][funcname] = func
             return __wrapper__
 
+        def __unicode_cast(self):
+            return self.__func(*self.__args, **self.__kw)
+
     def __wrapper__(*args, **kw):
         # Creates the proxy object, instead of the actual value.
         return __proxy__(args, kw)


this makes unicode() work for the proxies, but not str(). I tried to add a
similar hook for str(), but I failed (and I really don't understand how all
the various parts play together here ...)

That's for now, I'm still trying to get over this before I can start more
serious testing.

So long,

Michael



-- 
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100
http://www.noris.de - The IT-Outsourcing Company
 
Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk - 
Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689

--~--~---------~--~----~------------~-------~--~----~
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