[Mpuls-commits] r771 - in wasko/branches/2.0: . waskaweb/lib waskaweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Jan 19 20:43:41 CET 2010
Author: bh
Date: 2010-01-19 20:43:39 +0100 (Tue, 19 Jan 2010)
New Revision: 771
Modified:
wasko/branches/2.0/ChangeLog.txt
wasko/branches/2.0/waskaweb/lib/helpers.py
wasko/branches/2.0/waskaweb/model/logbook.py
Log:
* waskaweb/model/logbook.py (checkDate, checkTime),
waskaweb/lib/helpers.py (checkDate, checkTime): Move checkDate and
checkTime and the constants used by them to from helpers to
logbook becase that's the only place where they're actually used.
* waskaweb/model/logbook.py (LogbookEntryChecker.__init__): Adapt
accordinly.
Modified: wasko/branches/2.0/ChangeLog.txt
===================================================================
--- wasko/branches/2.0/ChangeLog.txt 2010-01-19 18:46:36 UTC (rev 770)
+++ wasko/branches/2.0/ChangeLog.txt 2010-01-19 19:43:39 UTC (rev 771)
@@ -1,5 +1,14 @@
2010-01-19 Bernhard Herzog <bh at intevation.de>
+ * waskaweb/model/logbook.py (checkDate, checkTime),
+ waskaweb/lib/helpers.py (checkDate, checkTime): Move checkDate and
+ checkTime and the constants used by them to from helpers to
+ logbook becase that's the only place where they're actually used.
+ * waskaweb/model/logbook.py (LogbookEntryChecker.__init__): Adapt
+ accordinly.
+
+2010-01-19 Bernhard Herzog <bh at intevation.de>
+
* waskaweb/lib/base.py (BaseController.__before__): Fix syntax
error
Modified: wasko/branches/2.0/waskaweb/lib/helpers.py
===================================================================
--- wasko/branches/2.0/waskaweb/lib/helpers.py 2010-01-19 18:46:36 UTC (rev 770)
+++ wasko/branches/2.0/waskaweb/lib/helpers.py 2010-01-19 19:43:39 UTC (rev 771)
@@ -1,4 +1,4 @@
-# Copyright 2007, 2008 Intevation GmbH, Germany, <info at intevation.de>
+# Copyright 2007, 2008, 2010 Intevation GmbH, Germany, <info at intevation.de>
#
# This file is part of mpuls WASKA (CoMPUter-based case fiLeS -
# Web-Anwendungs-Server fuer Kompetenzagenturen).
@@ -42,8 +42,6 @@
from waskaweb.lib.adelexml import EVAL_NAMES, EVAL_DESCRIPTIONS
from waskaweb.lib.filecache import FileCache
-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})')
PRINTABLE = frozenset(printable)
@@ -262,19 +260,7 @@
r.append(R < (L-3) and u'...' or s[L-(L-R):])
return u''.join(r)
-def checkDate(value):
- m = VALID_DATE.match(value)
- if not m: return None
- try:
- return datetime.datetime(int(m.group(3)), int(m.group(2)), int(m.group(1)))
- except ValueError:
- return None
-def checkTime(value):
- m = VALID_TIME.match(value)
- if not m: return None
- return datetime.timedelta(hours = int(m.group(1)), minutes = int(m.group(2)))
-
def hasErrorsOnPage(page_id):
case = session.get('case')
navigation = session.get('navigation.tree')
Modified: wasko/branches/2.0/waskaweb/model/logbook.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/logbook.py 2010-01-19 18:46:36 UTC (rev 770)
+++ wasko/branches/2.0/waskaweb/model/logbook.py 2010-01-19 19:43:39 UTC (rev 771)
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# Copyright 2007, 2008 Intevation GmbH, Germany, <info at intevation.de>
+# Copyright 2007, 2008, 2010 Intevation GmbH, Germany, <info at intevation.de>
#
# This file is part of mpuls WASKA (CoMPUter-based case fiLeS -
# Web-Anwendungs-Server fuer Kompetenzagenturen).
@@ -27,13 +27,15 @@
# Authors:
# Sascha L. Teichmann <sascha.teichmann at intevation.de>
+import re
+from datetime import timedelta, datetime
+
from waskaweb.lib.db import db
import waskaweb.lib.helpers as h
from waskaweb.lib.sql_helper import range_compress
from waskaweb.model.case import CaseBundle
-from datetime import timedelta
KIND2TEXT = {
"1": u'Gespräch mit dem/der Jugendlichen',
@@ -103,6 +105,27 @@
WHERE id = %(id)s
"""
+VALID_DATE = re.compile(r'^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})$')
+
+def checkDate(value):
+ m = VALID_DATE.match(value)
+ if not m:
+ return None
+ try:
+ return datetime(int(m.group(3)), int(m.group(2)), int(m.group(1)))
+ except ValueError:
+ return None
+
+
+VALID_TIME = re.compile(r'^([0-9]{1,2}):([0-9]{2})')
+
+def checkTime(value):
+ m = VALID_TIME.match(value)
+ if not m:
+ return None
+ return timedelta(hours = int(m.group(1)), minutes = int(m.group(2)))
+
+
class LogbookEntry:
def __init__(self):
@@ -301,7 +324,7 @@
errors = []
datum = params.getone('date')
if datum:
- ndatum = h.checkDate(datum)
+ ndatum = checkDate(datum)
if not ndatum:
errors.append("Datum '%s' ist nicht korrekt. (dd.MM.JJJJ)." % datum)
datum = ndatum
@@ -310,7 +333,7 @@
zeit = params.get('time')
if zeit:
- nzeit = h.checkTime(zeit)
+ nzeit = checkTime(zeit)
if nzeit is None:
errors.append("Uhrzeit '%s' ist nicht korrekt. (HH:MM)." % zeit)
elif datum:
More information about the Mpuls-commits
mailing list