[Mpuls-commits] r5467 - base/trunk/mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Oct 13 20:03:09 CEST 2011


Author: bh
Date: 2011-10-13 20:03:09 +0200 (Thu, 13 Oct 2011)
New Revision: 5467

Modified:
   base/trunk/mpulsweb/lib/search.py
Log:
Allow date objects as values for search options.
This will allow better validation of the sdate and edate options by
using date object for their values instead of strings in german date
format.


Modified: base/trunk/mpulsweb/lib/search.py
===================================================================
--- base/trunk/mpulsweb/lib/search.py	2011-10-13 17:56:26 UTC (rev 5466)
+++ base/trunk/mpulsweb/lib/search.py	2011-10-13 18:03:09 UTC (rev 5467)
@@ -2,6 +2,7 @@
 import logging
 import re
 import functools
+import datetime
 
 import psycopg2.extras
 
@@ -121,8 +122,8 @@
                                         sanitize_string)
             elif isinstance(value, basestring):
                 value = sanitize_string(value)
-            elif isinstance(value, int):
-                # Nothing to do for ints.
+            elif isinstance(value, (int, datetime.date)):
+                # Nothing to do for ints and dates
                 pass
             else:
                 log.warning("Omitting option %r because the value has the"



More information about the Mpuls-commits mailing list