#2447: WidgetsList should not remove declared widgets from class scope
-------------------------+--------------------------------------------------
 Reporter:  xaka         |        Owner:  chrisz  
     Type:  enhancement  |       Status:  assigned
 Priority:  normal       |    Milestone:  1.x     
Component:  TurboGears   |      Version:  1.1 HEAD
 Severity:  normal       |   Resolution:          
 Keywords:               |  
-------------------------+--------------------------------------------------
Changes (by chrisz):

  * owner:  => chrisz
  * status:  new => assigned
  * milestone:  1.1 => 1.x

Comment:

 So you're adding a feature by removing one line of code ;-)

 I'm not sure whether this line had a purpose? If only to avoid
 accidentally overriding list methods e.g. by adding a field with the name
 "append"? But we could inhibit such overriding like this:
 {{{
                 if name in dir(WidgetsList):
                     del class_dict[name]
 }}}
 Also, if we allow attributes for declaratively defined lists, then to be
 consistent, shouldn't we set them also when the widget list is defined
 like this:
 {{{
     fields = WidgetsList(TextField('username', ...), TextField('password',
 ...))
 }}}
 This could be provided by adding the following code to the
 `WidgetList.__init__` method:
 {{{
             for arg in args:
                 if arg.name not in dir(WidgetsList):
                     setattr(self, arg.name, arg)
 }}}
 However, attributes for widgets appended or extend later to the widget
 list would still be missing. We could also handle this, but that will get
 even more complex.

 I'd like to get some feedback before changing something here.

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