Thursday, January 31, 2013

Re: an elusive ValueError: 'str' object not callable -- lost.

On Wed, Jan 30, 2013 at 6:59 PM, Maurice Asimov <mauriceasimov@gmail.com> wrote:
> Hey guys.
>
> I recently started getting a ValueError complaining that an str is not
> callable -- in a very wierd place.
>
> This happens to some calls to messages.info(request, 'somethingsomething'),
> in one of those cases __inside the django console__
>
> Any other ideas what's wrong? Anyone bumped into this?
>
> The same problem occured in part of the app I control, removing the call to
> messages.info solved it.
>
> Anything at all? Thanks.
>

Somehow, you have overwritten the 'info' attribute of the
django.messages module with a string, and so it blows up.

Look for places where you assign to anything named 'info':

ack "\Winfo.*="
ack "setattr\([^,]*,.*info"

or

grep -r "[^a-z_]info.*=" *
grep -r "setattr([^,]*,.*info" *

I know you said not to blame your custom middleware, but this does not
happen with stock 1.4.2, so if you have this happening even in
requests that do not touch your views, it most likely will be your
middleware.

It would be easy to test if you can reliably reproduce this in the
admin site, simply disable the custom middleware and see if you can
still reproduce the error.

Cheers

Tom

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment