X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FEvents.py;h=ac72c65c5ac113640ace0733d518b21c61aa96e4;hb=bfbd7ab0a157ca63f286836252d143341ca677ec;hp=b29ed5ccc805bfc6e4836ac2acbd50a083f84ad9;hpb=54149bad0e9278774ad0936858c845ecf9a13065;p=plcapi.git diff --git a/PLC/Events.py b/PLC/Events.py index b29ed5c..ac72c65 100644 --- a/PLC/Events.py +++ b/PLC/Events.py @@ -4,7 +4,7 @@ # Tony Mack # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: Events.py,v 1.4 2006/10/31 21:46:14 mlhuang Exp $ +# $Id: Events.py,v 1.9 2006/11/29 22:14:32 tmack Exp $ # from PLC.Faults import * @@ -24,10 +24,10 @@ class Event(Row): 'event_id': Parameter(int, "Event identifier"), 'person_id': Parameter(int, "Identifier of person responsible for event, if any"), 'node_id': Parameter(int, "Identifier of node responsible for event, if any"), - 'event_type': Parameter(str, "Type of event"), - 'object_type': Parameter(str, "Type of object affected by this event"), 'fault_code': Parameter(int, "Event fault code"), - 'call': Parameter(str, "Call responsible for this event"), + 'call_name': Parameter(str, "Call responsible for this event"), + 'call': Parameter(str, "Call responsible for this event, including paramters"), + 'message': Parameter(str, "High level description of this event"), 'runtime': Parameter(float, "Runtime of event"), 'time': Parameter(int, "Date and time that the event took place, in seconds since UNIX epoch", ro = True), 'object_ids': Parameter([int], "IDs of objects affected by this event") @@ -60,17 +60,17 @@ class Events(Table): Representation of row(s) from the events table in the database. """ - def __init__(self, api, event_filter): - Table.__init__(self, api, Event) + def __init__(self, api, event_filter = None, columns = None): + Table.__init__(self, api, Event, columns) sql = "SELECT %s FROM view_events WHERE True" % \ - ", ".join(Event.fields) + ", ".join(self.columns) if event_filter is not None: - if isinstance(event_filter, list): + if isinstance(event_filter, (list, tuple, set)): event_filter = Filter(Event.fields, {'event_id': event_filter}) elif isinstance(event_filter, dict): event_filter = Filter(Event.fields, event_filter) sql += " AND (%s)" % event_filter.sql(api) - + sql += " ORDER BY %s" % Event.primary_key self.selectall(sql)