#2430: Widgets should use lazy params initialization to prevent from 
inconsistence
------------------------+---------------------------------------------------
 Reporter:  xaka        |       Owner:  Chris Arndt 
     Type:  defect      |      Status:  new         
 Priority:  normal      |   Milestone:  1.0.x bugfix
Component:  TG Widgets  |     Version:  1.0.9       
 Severity:  normal      |    Keywords:              
------------------------+---------------------------------------------------
 Now, when we pass params to widget's contructor, logic 1st look at
 **params and if nothing was found - check self object. Bah! All params
 stores as ParamDescriptor instances on meta-level and when contructor
 checking self object for param existence it call __get__ of descriptor
 which do getattr(self, param) and call returned value  if it callable.
 Where is problem?

 {{{
 class MyWidget(turbogears.widgets.Widget):
    @property
    def some_param(self):
       # connect to database, retrieve remote resource
       # or do another operation which can't be processed
       # at __init__ call-time
       ...
 }}}

 1. ParamDescriptor should return None if param is undefined in object

 2. Widget's contructor should not to check self object for param

 I've attach patch which fix that logic in right way (IMHO).

-- 
Ticket URL: <http://trac.turbogears.org/ticket/2430>
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