[Mpuls-commits] r3925 - in base/trunk: . mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Oct 7 18:19:46 CEST 2010


Author: bh
Date: 2010-10-07 18:19:46 +0200 (Thu, 07 Oct 2010)
New Revision: 3925

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/lib/validators.py
Log:
* mpulsweb/lib/validators.py (MyDateConverter.__init__): Add
comment about the non-obvious unusual use of super to access the
base class __init__ method


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-10-07 16:00:54 UTC (rev 3924)
+++ base/trunk/ChangeLog	2010-10-07 16:19:46 UTC (rev 3925)
@@ -1,5 +1,11 @@
 2010-10-07  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/lib/validators.py (MyDateConverter.__init__): Add
+	comment about the non-obvious unusual use of super to access the
+	base class __init__ method
+
+2010-10-07  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/lib/validators.py
 	(EvaluationFormValidator.start_date_field)
 	(EvaluationFormValidator.end_date_field): Removed.  They're not

Modified: base/trunk/mpulsweb/lib/validators.py
===================================================================
--- base/trunk/mpulsweb/lib/validators.py	2010-10-07 16:00:54 UTC (rev 3924)
+++ base/trunk/mpulsweb/lib/validators.py	2010-10-07 16:19:46 UTC (rev 3925)
@@ -223,6 +223,11 @@
     '''Own DateConverter which also allows Dates in dd.mm.jjjj style.'''
 
     def __init__(self, *args, **kw):
+        # usually, one uses super(MyDateConverter, self) to access the
+        # base class methods.  Here we use super(DateConverter, self),
+        # i.e. we specify the base class in the super call, in order to
+        # bypass DateConverter.__init__ which would not allow the
+        # month_style dd.mm.jjjj
         super(DateConverter, self).__init__(*args, **kw)
         if not self.month_style in ('dd/mm/yyyy', 'mm/dd/yyyy', 'dd.mm.jjjj'):
             raise TypeError("Bad month_style: %r" % self.month_style)



More information about the Mpuls-commits mailing list