#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      |   Resolution:                  
 Keywords:              |  
------------------------+---------------------------------------------------
Comment (by xaka):

 If you take a look on Form's class definition:
 {{{
 class Form(FormFieldsContainer):
     form = True
     name = "form"
     member_widgets = ["submit"]
     params = ["action", "method", "form_attrs", "use_name", "submit_text"]
 }}}
 You can see that '''method''' already defined as widget's parameter.
 Parameters can be not just a value, but a callable object. If parameter is
 callable it will be called _before_ passing to widget's template. Also it
 will be called when you'll try to access to that parameter via dot-
 notation (my_widget.method).

 What did you? In your class you assign instance of SingleSelectField to
 '''method''' variable. SingleSelectField is the widget. Every widget is
 callable object. At call time it returns ElementStream/Element instance.
 Also you define '''method''' as member widget which already defined as
 widget's parameter.

 At the render time TG's internal code tried to access to your member
 widget '''method''', which is parameter too, and expected to get Widget-
 base instance, but got Element instance. Why? Because '''method''' is the
 parameter, it has instance of some widget and as we know - every widget is
 the callable object.

-- 
Ticket URL: <http://trac.turbogears.org/ticket/2462#comment:1>
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

Reply via email to