#12256: TypeError when calling unicode(type(Form()))
---------------------------------+------------------------------------------
          Reporter:  sethrh      |         Owner:  nobody
            Status:  new         |     Milestone:        
         Component:  Forms       |       Version:  1.1   
        Resolution:              |      Keywords:        
             Stage:  Unreviewed  |     Has_patch:  0     
        Needs_docs:  0           |   Needs_tests:  0     
Needs_better_patch:  0           |  
---------------------------------+------------------------------------------
Comment (by kmtracey):

 Ha, I am able to reproduce, but I also find there's no need to do any
 fancy metaclass stuff to see similar behavior.  A simple class based on
 object, that provides its own implementation of `__unicode__` behaves the
 same way:

 {{{
 >>> class X(object):
 ...     def __init__(self, x):
 ...         self.x = x
 ...     def __unicode__(self):
 ...         return unicode(self.x)
 ...
 >>> x = X(5)
 >>> unicode(x)
 u'5'
 >>> unicode(type(x))
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
 TypeError: unbound method __unicode__() must be called with X instance as
 first argument (got nothing instead)
 >>>

 }}}

 Given that, I don't see how this is a bug in Django instead of a bug in
 the debugger.  (And I'd expect it to have trouble with other Django
 classes -- plenty of which define `__unicode__` -- are forms really its
 only trouble spot?)

-- 
Ticket URL: <http://code.djangoproject.com/ticket/12256#comment:2>
Django <http://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=.


Reply via email to