Changes between Initial Version and Version 1 of Ticket #19114


Ignore:
Timestamp:
Oct 12, 2012, 2:27:52 AM (12 years ago)
Author:
Claude Paroz
Comment:

I think that there is no need to call ugettext_lazy in the __str__ method. ugettext should be fine here.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #19114

    • Property Easy pickings set
    • Property Has patch unset
    • Property Triage Stage UnreviewedAccepted
  • Ticket #19114 – Description

    initial v1  
    1 the admin LogEntry function __unicode__() returns a proxy object for lazzy translation string in the case the self.action_flag is different from 1 2 or 3.
     1the admin `LogEntry` function `__unicode__()` returns a proxy object for lazzy translation string in the case the self.action_flag is different from 1 2 or 3.
    22
    3 This leads to an exception in the admin when trying to delete such LogEntry or an associated object of it, when the admin needs its name to be displayed in the "delete confirmation" page.
     3This leads to an exception in the admin when trying to delete such `LogEntry` or an associated object of it, when the admin needs its name to be displayed in the "delete confirmation" page.
    44
    55the fix is to cast to unicode the returned value in line 46 of
     
    1212
    1313
    14 it is because we are using a custom action_flag of 4 in some of our LogEntry, that the bug popped up.
    15 You will notice that the 3 other cases in the __unicode__ function are not problematic because they are printf and therefor a new unicode string is geenrated and returned, and the proxy is "gettext-ed" before.
     14it is because we are using a custom action_flag of 4 in some of our `LogEntry`, that the bug popped up.
     15You will notice that the 3 other cases in the `__unicode__` function are not problematic because they are printf and therefor a new unicode string is geenrated and returned, and the proxy is "gettext-ed" before.
    1616
    1717
    1818the exception was:
    19 
     19{{{
    2020  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 111, in get_response
    2121    response = callback(request, *callback_args, **callback_kwargs)
     
    6767
    6868TypeError: coercing to Unicode: need string or buffer, __proxy__ found
     69}}}
Back to Top