Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #2443: fix_and_test_case.diff

File fix_and_test_case.diff, 1.6 KB (added by xaka, 2 years ago)
  • turbogears/widgets/tests/test_widgets.py

     
    2424    view.engines = engines 
    2525    assert 'templating engine is not yet loaded' in msg 
    2626 
     27def test_same_classes_names_in_same_module(): 
     28    """Test for ticket #2443""" 
     29    class TestWidget(widgets.Widget): 
     30            template = """<img />""" 
     31    w1 = TestWidget() 
     32 
     33    class TestWidget(widgets.Widget): 
     34            template = """<img />""" 
     35    w2 = TestWidget() 
     36     
     37    w1.render() # NoneType object is not callable was here before the fix 
     38    w2.render() 
     39 
     40    # if downed here then all is ok and we can use 
     41    # same classes names for widgets in same module 
     42    assert True 
     43 
    2744def test_label(): 
    2845    """Tests simple labels""" 
    2946    label = widgets.Label("foo") 
  • turbogears/widgets/meta.py

     
    5959            dct["__init__"] = _decorate_widget_init(dct["__init__"]) 
    6060            cls.__init__ = dct["__init__"] 
    6161        super(MetaWidget, cls).__init__(name, bases, dct) 
    62         modname = "%s.%s" % (cls.__module__, name) 
    6362        if cls.template: 
    6463            (cls.template_c, 
    65              cls.template) = load_kid_template(cls.template, modname) 
     64             cls.template) = load_kid_template(cls.template) 
    6665        cls._locked = False 
    6766 
    6867#############################################################################