change in comment to reflect use of lists instead of tuples
[plcapi.git] / PLC / LeaseFilter.py
index 84f84b7..888b18e 100644 (file)
@@ -21,18 +21,20 @@ class LeaseFilter(Filter):
     # general notes on input parameters
     # int_timestamp: number of seconds since the epoch
     # str_timestamp: see Timestamp.sql_validate
-    # timeslot: a tuple (from, until), each being either int_timestamp or
+    # timeslot: a list [from, until], each being either int_timestamp or
     # str_timestamp
 
     local_fields = {
         'alive': Mixed(
             Parameter(int, "int_timestamp: leases alive at that time"),
             Parameter(str, "str_timestamp: leases alive at that time"),
-            Parameter(tuple, "timeslot: the leases alive during this timeslot")),
-        'clip':  Mixed(
+            Parameter(list, "timeslot: the leases alive during this timeslot"),
+            ),
+        'clip': Mixed(
             Parameter(int, "int_timestamp: leases alive after that time"),
             Parameter(str, "str_timestamp: leases alive after that time"),
-            Parameter(tuple, "timeslot: the leases alive during this timeslot")),
+            Parameter(list, "timeslot: the leases alive during this timeslot"),
+            ),
         ########## macros
         # {'day' : 0} : all leases from today and on
         # {'day' : 1} : all leases today (localtime at the myplc)
@@ -92,7 +94,7 @@ class LeaseFilter(Filter):
             # the lease is alive at that time if from <= alive <= until
             alive = LeaseFilter.quote(alive)
             return LeaseFilter.sql_time_in_range(alive, 't_from', 't_until')
-        elif isinstance(alive, tuple):
+        elif isinstance(alive, (tuple, list)):
             (f, u) = alive
             f = LeaseFilter.quote(f)
             u = LeaseFilter.quote(u)
@@ -105,7 +107,7 @@ class LeaseFilter(Filter):
         if isinstance(clip, int) or isinstance(clip, str):
             start = LeaseFilter.quote(clip)
             return LeaseFilter.sql_timeslot_after('t_from', 't_until', start)
-        elif isinstance(clip, tuple):
+        elif isinstance(clip, (tuple, list)):
             (f, u) = clip
             f = LeaseFilter.quote(f)
             u = LeaseFilter.quote(u)