aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Buesch <m@bues.ch>2018-05-15 21:46:46 +0200
committerMichael Buesch <m@bues.ch>2018-05-15 21:46:46 +0200
commitd6cc0b0910197e3455f56bc487e5cc1fae8aef6c (patch)
treed3986d0882e3e7daa659f0f604992da941359e1f
parent34637a45b27985334a32e721827c49fca3f8811f (diff)
downloadcms-d6cc0b0910197e3455f56bc487e5cc1fae8aef6c.zip
cms-d6cc0b0910197e3455f56bc487e5cc1fae8aef6c.tar.xz
Treat variables that expand to None as non-existing
Signed-off-by: Michael Buesch <m@bues.ch>
-rw-r--r--cms/cms.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/cms/cms.py b/cms/cms.py
index 7a29a86..89fc5a6 100644
--- a/cms/cms.py
+++ b/cms/cms.py
@@ -484,10 +484,10 @@ class CMSStatementResolver(object):
def expandVariable(self, name):
try:
value = self.variables[name]
- try:
+ if callable(value):
value = value(self, name)
- except (TypeError) as e:
- pass
+ if value is None:
+ raise KeyError
return str(value)
except (KeyError, TypeError) as e:
return ""
bues.ch cgit interface