From 6c98ac7b4385db298d2a545c4ef11f3f7ebad61d Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Tue, 6 Feb 2024 11:46:32 +0100 Subject: [PATCH] tweaked LeaseFilter to allow lists instead of tuples for clip and alive --- PLC/LeaseFilter.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/PLC/LeaseFilter.py b/PLC/LeaseFilter.py index 84f84b7..c7e31bc 100644 --- a/PLC/LeaseFilter.py +++ b/PLC/LeaseFilter.py @@ -28,11 +28,13 @@ class LeaseFilter(Filter): '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) -- 2.43.0