﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
12256	TypeError when calling unicode(type(Form()))	Seth Hill	nobody	"Hello all, 

I've discovered a bug (I think) relating to the Form metaclass. I noticed it while running Eric4's debugger through a view which handled a form. 

My code is doing this:
{{{
def view_function(request):
    if request.method == ""POST"": 
        form = MyForm(request.POST)
        if form.is_valid():
            ...
}}}

As soon as I create the form instance, I get a TypeError returned on the web page. This is happens when the debugger calls unicode() on all of the local variables to display their types and values. After the server gets the TypeError, the debug session hangs. 

{{{
>>> type(Form)
<class 'django.forms.forms.DeclarativeFieldsMetaclass'>
>>> f = Form()
>>> type(f)
<class 'django.forms.forms.Form'>
>>> unicode(type(f))
Traceback (most recent call last):
   File ""<console>"", line 1, in <module>
TypeError: unbound method __unicode__() must be called with Form instance as first argument (got nothing instead)
>>> import inspect
>>> inspect.getsource(type(f).__unicode__)
'    def __unicode__(self):\n        return self.as_table()\n'
}}}

It appears that the metaclass is somehow sticking {{{Form.__unicode__}}} into {{{type(Form).__unicode__}}}. 

I'm running Django 1.1 SVN-11366 under Python 2.5.1 on Windows XP pro sp2. 
"		closed	Forms	1.1		invalid			Unreviewed	0	0	0	0	0	0
