[Mpuls-commits] r1556 - wasko/branches/2.0/waskaweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Feb 15 15:11:39 CET 2010


Author: torsten
Date: 2010-02-15 15:11:38 +0100 (Mon, 15 Feb 2010)
New Revision: 1556

Modified:
   wasko/branches/2.0/waskaweb/lib/evaluation.py
Log:
Deleted import of sql_helpers in lib.evaluation


Modified: wasko/branches/2.0/waskaweb/lib/evaluation.py
===================================================================
--- wasko/branches/2.0/waskaweb/lib/evaluation.py	2010-02-15 14:05:33 UTC (rev 1555)
+++ wasko/branches/2.0/waskaweb/lib/evaluation.py	2010-02-15 14:11:38 UTC (rev 1556)
@@ -27,15 +27,24 @@
 import traceback
 import codecs
 import cStringIO as StringIO
+from types import TupleType
 
 import psycopg2
 
 from mpulsweb.lib.helpers import format_number, timedelta_in_minutes 
 from mpulsweb.lib.base import _, c, session
 from mpulsweb.lib.db import db
-from waskaweb.lib.sql_helper import where_ids
+
 from waskaweb.model.logbook import KIND2TEXT, SUMKIND2TEXT  
 
+def where_ids(compressed, idname="id"):
+    if not compressed:
+        return "FALSE"
+    between = "%s BETWEEN %%d AND %%d" % idname
+    single  = "%s = %%d" % idname
+    return " OR ".join([(type(x) is TupleType and between or single) % x 
+        for x in compressed])
+
 class Evaluation:
     def __init__(self, compressed_ids=None):
         self.total_valid = 0;



More information about the Mpuls-commits mailing list