From dfd43b55aad26f8b0745f5c9b990f5e48fedb32a Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 11 Jan 2018 15:17:58 -0600 Subject: [PATCH] Allow passing None to `Form.set_renderer()` i.e. to remove any renderer which has been set --- tailbone/forms2/core.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tailbone/forms2/core.py b/tailbone/forms2/core.py index d3301bdf..95561fed 100644 --- a/tailbone/forms2/core.py +++ b/tailbone/forms2/core.py @@ -576,7 +576,11 @@ class Form(object): self.enums.pop(key, None) 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): self.widgets[key] = widget