#2462: member variable in Form called 'method', causing exception
------------------------+---------------------------------------------------
Reporter: rmancy | Owner:
Type: defect | Status: new
Priority: normal | Milestone: __unclassified__
Component: TurboGears | Version: 1.0.8
Severity: normal | Keywords:
------------------------+---------------------------------------------------
TurboGears 1.0.8
Python 2.4.3
I have this widget. It does not seem to work because of the 'self.method'
member variable. I get the stacktrace below
{{{
class ReserveWorkflow(Form):
member_widgets = ['method']
params = []
template="beaker.server.templates.reserve_workflow"
def __init__(self,*args,**kw):
super(ReserveWorkflow,self).__init__(*args, **kw)
self.method = SingleSelectField(name='method', label='Method',
options=[(-1,'None')] + [(elem,elem) for elem in
model.Distro.all_methods()])
}}}
{{{
raceback (most recent call last):
File "/usr/lib/python2.4/site-packages/cherrypy/_cphttptools.py", line
121, in _run
self.main()
File "/usr/lib/python2.4/site-packages/cherrypy/_cphttptools.py", line
264, in main
body = page_handler(*virtual_path, **self.params)
File "<string>", line 3, in index
File "/usr/lib/python2.4/site-packages/turbogears/controllers.py", line
358, in expose
output = database.run_with_transaction(
File "<string>", line 5, in run_with_transaction
File "/usr/lib/python2.4/site-packages/turbogears/database.py", line
410, in sa_rwt
retval = func(*args, **kw)
File "<string>", line 5, in _expose
File "/usr/lib/python2.4/site-packages/turbogears/controllers.py", line
373, in <lambda>
mapping, fragment, args, kw)))
File "/usr/lib/python2.4/site-packages/turbogears/controllers.py", line
410, in _execute_func
output = errorhandling.try_call(func, *args, **kw)
File "/usr/lib/python2.4/site-packages/turbogears/errorhandling.py",
line 77, in try_call
return func(self, *args, **kw)
File
"/home/raymond/dev/Beaker/test3/Server/beaker/server/reserve_workflow.py",
line 13, in index
widget = ReserveWorkflowWidget()
File "/usr/lib/python2.4/site-packages/turbogears/widgets/meta.py", line
175, in widget_init
validator = generate_schema(self.validator, widgets)
File "/usr/lib/python2.4/site-packages/turbogears/widgets/meta.py", line
283, in generate_schema
if widget.is_named:
AttributeError: 'Element' object has no attribute 'is_named'
}}}
Now if I change it to 'self.method_' (notice the trailing underscore) and
obviously change the corersponding entry in member_widgets and in the
template, then it works fine.
Not sure what the problem is. Maybe something to do with the
iter_member_widgets generator object ??
--
Ticket URL: <http://trac.turbogears.org/ticket/2462>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en