#2443: Exception "TypeError: 'NoneType' object is not callable" on render 
widgets
------------------------+---------------------------------------------------
 Reporter:  xaka        |       Owner:                  
     Type:  defect      |      Status:  new             
 Priority:  normal      |   Milestone:  __unclassified__
Component:  TurboGears  |     Version:  1.0.9           
 Severity:  normal      |    Keywords:                  
------------------------+---------------------------------------------------
 {{{
 import turbogears as tg
 tg.view.load_engines()

 class MyWidget(tg.widgets.Widget):
     template = """
     <div>hello world</div>
     """

 class Module1(object):
     class widget(MyWidget):
         pass
 m1 = Module1()
 w1 = m1.widget()

 class Module2(object):
     class widget(MyWidget):
         pass
 m2 = Module2()
 w2 = m2.widget()

 w1.render()
 w2.render()
 }}}

 Problem in turbogears.widgets.meta module. To generate template's module
 name it
 uses the following algo:
 {{{
 modname = "%s.%s" % (cls.__module__.__name__, cls.__name__)
 }}}

 In example above we have 2 different classes (Module1.widget == class1 and
 Module2.wiget == class2) with same names and living in same module i.e.
 modname for class1 == modname for class2. As result when we initiate
 class2 with existing modname in sys.modules it destroys prev template's
 module for class1 and during rendering we get the exception.

 You can write your own fix for that issue. Attached patch is just "way to
 fix".

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