On Sat, 2006-10-14 at 21:30 +0200, [EMAIL PROTECTED] wrote:
> Hi all,
> 
> I'm currently writing some doctests for a model and got the following error 
> message which I don't understand:
> 
> Failed example:
>     print q
> Exception raised:
>     Traceback (most recent call last):
>       File "/usr/local/lib/python2.4/site-packages/django/test/doctest.py", 
> line 1243, in __run
>         compileflags, 1) in test.globs
>       File "<doctest ais.core.models.Quittung[11]>", line 1, in ?
>         print q
>       File "/home/dirk/django/projects/ais/core/models.py", line 674, in 
> __str__
>         return _('Quittung for User %s on MetaObjekt %s, seen: %s, ack: %s') \
>     TypeError: 'bool' object is not callable

I wonder if this is an unfortunate naming clash?

When running from the interactive prompt (including during doctest
runs), the variable '_' is used to store the most recent result. This
clashes with Django's internal use of _ as the name of a function. The
problem here is that instead of requiring _() to be aliased inside each
model, it was decided to stick this function into __builtins__. I wasn't
completely thrilled with that at the time, mostly for non-specific
reasons, and now we might have a reason to be concerned.

Needs more investigation to confirm if this is the case. Ine test would
be to explicitly import gettext() as _() in your test file, since that
would introduce different aliasing rules for the two cases, I believe.

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

Reply via email to