[Mpuls-commits] r207 - in waska/trunk: . waskaweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Oct 21 16:33:40 CEST 2008
Author: teichmann
Date: 2008-10-21 16:33:39 +0200 (Tue, 21 Oct 2008)
New Revision: 207
Modified:
waska/trunk/ChangeLog.txt
waska/trunk/waskaweb/lib/helpers.py
Log:
Fixed issue518
Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt 2008-10-21 09:32:45 UTC (rev 206)
+++ waska/trunk/ChangeLog.txt 2008-10-21 14:33:39 UTC (rev 207)
@@ -1,3 +1,10 @@
+2008-10-10 Sascha L. Teichmann <sascha.teichmann at intevation.de>
+
+ Fixed issue518
+
+ * waskaweb/lib/helpers.py: Use correct regular expression for date validation
+ now.
+
2008-10-21 Torsten Irlaender <torsten.irlaender at intevation.de>
Fixed issue542
Modified: waska/trunk/waskaweb/lib/helpers.py
===================================================================
--- waska/trunk/waskaweb/lib/helpers.py 2008-10-21 09:32:45 UTC (rev 206)
+++ waska/trunk/waskaweb/lib/helpers.py 2008-10-21 14:33:39 UTC (rev 207)
@@ -35,7 +35,7 @@
import datetime
-VALID_DATE = re.compile(r'^[0-9]{1,2}.[0-9]{1,2}.[0-9]{4}$')
+VALID_DATE = re.compile(r'^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})$')
VALID_TIME = re.compile(r'^([0-9]{1,2}):([0-9]{2})')
def hasRole(rolelist):
@@ -150,9 +150,9 @@
return " ".join(out)
def checkDate(value):
- if not VALID_DATE.match(value): return None
- token = value.split('.')
- return datetime.datetime(int(token[2]), int(token[1]), int(token[0]))
+ m = VALID_DATE.match(value)
+ if not m: return None
+ return datetime.datetime(int(m.group(3)), int(m.group(2)), int(m.group(1)))
def checkTime(value):
m = VALID_TIME.match(value)
More information about the Mpuls-commits
mailing list