Allow passing None to Form.set_renderer()

i.e. to remove any renderer which has been set
This commit is contained in:
Lance Edgar 2018-01-11 15:17:58 -06:00
parent f021df446c
commit dfd43b55aa

View file

@ -576,7 +576,11 @@ class Form(object):
self.enums.pop(key, None) self.enums.pop(key, None)
def set_renderer(self, key, renderer): def set_renderer(self, key, renderer):
self.renderers[key] = renderer if renderer is None:
if key in self.renderers:
del self.renderers[key]
else:
self.renderers[key] = renderer
def set_widget(self, key, widget): def set_widget(self, key, widget):
self.widgets[key] = widget self.widgets[key] = widget