On Thu, Mar 10, 2011 at 7:10 AM, Venkatraman S <venka...@gmail.com> wrote:

> I stumbled on this 'probable' bug and thought would share it with the group
> to ensure that it indeed is a bug and not something that i have been
> hallucinating :)
> When you try using force_unicode without importing it, the django console
> does not report an error; for eg, when i was playing around with LogEntry,
> using like :
> ..
> ..
> somecode_here_1
> LogUserAction.objects.log_action(
>     user_id         = request.user.pk,
>     content_type_id = ContentType.objects.get_for_model(object).pk,
>     object_id       = object.pk,
>     object_repr     = force_unicode(object),
>     action_flag     = CHANGE
>   )
> somecode_here_2
> ..
> render_to-response...
>
> The code just silently failed - i.e control never came to somecode_here_2 ,
> but somehow the template got rendered without any errors. Thoughts?
>

There's nothing magic about force_unicode, Python is going to raise an
exception if you try to use it without importing it. My initial guess is
this code you have shown is in a try/except that is swallowing the
exception, somewhere in those dots representing other code not shown.

Karen
-- 
http://tracey.org/kmt/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to