#21019: force_text fails on class object with __unicode__ instance method ----------------------------+------------------------ Reporter: drtyrsa | Owner: nobody Type: Bug | Status: new Component: Utilities | Version: 1.5 Severity: Normal | Keywords: force_text Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 1 | UI/UX: 0 ----------------------------+------------------------ {{{ In [10]: class A(object): def __unicode__(self): pass ....:
In [11]: force_text(A) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-13-f9169705858c> in <module>() ----> 1 force_text(A) .../django/utils/encoding.pyc in force_text(s, encoding, strings_only, errors) 97 if not isinstance(s, six.string_types): 98 if hasattr(s, '__unicode__'): ---> 99 s = s.__unicode__() 100 else: 101 if six.PY3: TypeError: unbound method __unicode__() must be called with A instance as first argument (got nothing instead) }}} -- Ticket URL: <https://code.djangoproject.com/ticket/21019> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/050.5dca4fa608c7835b87772cc554ab0d2c%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.