[Mpuls-commits] r5901 - base/trunk/mpulsweb/model

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Fri Mar 9 14:43:59 CET 2012


Author: bricks
Date: 2012-03-09 14:43:59 +0100 (Fri, 09 Mar 2012)
New Revision: 5901

Modified:
   base/trunk/mpulsweb/model/phase.py
Log:
Add repr methods for PhasePart and Fields for easier debugging


Modified: base/trunk/mpulsweb/model/phase.py
===================================================================
--- base/trunk/mpulsweb/model/phase.py	2012-03-09 13:19:03 UTC (rev 5900)
+++ base/trunk/mpulsweb/model/phase.py	2012-03-09 13:43:59 UTC (rev 5901)
@@ -418,7 +418,12 @@
     def get_phase_name(self):
         return g.mpuls_config.get('phases', 'description')[0].get(self.phase)
 
+    def __repr__(self):
+        return "<PhasePart 0%x ok=%r active=%r id=%r name=%r " \
+               "description=%r>" % (id(self), self.is_ok(), self.is_active(),
+                       self.id, self.get_phase_name(), self.getDescription())
 
+
 class StartPhasePart(PhasePart):
     pass
 
@@ -477,7 +482,11 @@
                 return False
         return True
 
+    def __repr__(self):
+        return "<Field 0%x ok=%r id=%r page=%r name=%r>" % (id(self),
+                self.is_ok(), self.id, self.page, self.name)
 
+
 class Condition:
 
     def __init__(self, field, rule, it):



More information about the Mpuls-commits mailing list