[Mpuls-commits] r3884 - in base/trunk: . mpulsweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Oct 4 20:00:00 CEST 2010
Author: bh
Date: 2010-10-04 19:59:56 +0200 (Mon, 04 Oct 2010)
New Revision: 3884
Modified:
base/trunk/ChangeLog
base/trunk/mpulsweb/lib/renderer.py
Log:
* mpulsweb/lib/renderer.py (ViewRenderer._has_warnings): New.
Check whether there are known warnings for a given node
(ViewRenderer._renderLabel, ViewRenderer._renderErrors): Use
_has_warnings to determine whether the node to be rendered has
warnings instead of using equivalent inline code.
Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog 2010-10-04 17:50:19 UTC (rev 3883)
+++ base/trunk/ChangeLog 2010-10-04 17:59:56 UTC (rev 3884)
@@ -1,5 +1,13 @@
2010-10-04 Bernhard Herzog <bh at intevation.de>
+ * mpulsweb/lib/renderer.py (ViewRenderer._has_warnings): New.
+ Check whether there are known warnings for a given node
+ (ViewRenderer._renderLabel, ViewRenderer._renderErrors): Use
+ _has_warnings to determine whether the node to be rendered has
+ warnings instead of using equivalent inline code.
+
+2010-10-04 Bernhard Herzog <bh at intevation.de>
+
* mpulsweb/lib/renderer.py (ViewRenderer._checkWarnings): Fix typo
in comment
Modified: base/trunk/mpulsweb/lib/renderer.py
===================================================================
--- base/trunk/mpulsweb/lib/renderer.py 2010-10-04 17:50:19 UTC (rev 3883)
+++ base/trunk/mpulsweb/lib/renderer.py 2010-10-04 17:59:56 UTC (rev 3884)
@@ -263,7 +263,7 @@
def _renderLabel(self, node, labeltag=True):
meta = self._getMeta(node)
out = []
- warning = node.getIdentifier() in self.warnings and "warning" or ""
+ warning = self._has_warnings(node) and "warning" or ""
error = node.hasErrors() and "error" or ""
if labeltag:
out.append(tag("label", for_=node.getIdentifier()))
@@ -309,9 +309,8 @@
Render errors and warnings
"""
meta = self._getMeta(node)
- hasWarnings = node.getIdentifier() in self.warnings
out = []
- if hasWarnings and not node.hasErrors():
+ if self._has_warnings(node) and not node.hasErrors():
spanClass = 'warning'
else:
spanClass = 'error'
@@ -323,6 +322,10 @@
return "".join(out)
+ def _has_warnings(self, node):
+ """Return whether there are known warnings for the node"""
+ return node.getIdentifier() in self.warnings
+
def _checkWarnings(self, node):
"""Check node for warnings by evaluating the relevant warning rules.
Only rules that are warnings, as determined by the rule's
More information about the Mpuls-commits
mailing list