From f93855fed16cc2e5eabe10871b700b5ea5974f74 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Thu, 19 Oct 2006 15:41:37 +0000 Subject: [PATCH] - add support for query on fault_code field --- PLC/Events.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/PLC/Events.py b/PLC/Events.py index e72563e..4dd6288 100644 --- a/PLC/Events.py +++ b/PLC/Events.py @@ -43,7 +43,7 @@ class Events(Table): object_types = None, object_ids = None, fault_codes = None): self.api = api - + sql = "SELECT %s from view_events WHERE True" % ", ".join(Event.fields) if event_ids: @@ -60,9 +60,12 @@ class Events(Table): if object_types: sql += " AND object_type in (%s)" % ", ".join(api.db.quote(object_types)) - + + if fault_codes: + sql += " And fault_code in (%s)" % ", ".join(map(str, fault_codes)) + rows = self.api.db.selectall(sql) - + for row in rows: self[row['event_id']] = event = Event(api, row) for aggregate in ['object_ids']: -- 2.45.2