X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FEvents.py;h=c01f5893e81c2975239d7a39edc1e5c5abf4df50;hb=da364bcb34b75077dc6aa296996b422c7e7101cc;hp=b8131c8911a405a1dc11c15eca09f4ba1b65fa33;hpb=e347fc823bbba9d88a3fddf07d5c21024dfd1e55;p=plcapi.git diff --git a/PLC/Events.py b/PLC/Events.py index b8131c8..c01f589 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.6 2006/11/09 03:07:42 mlhuang Exp $ +# $Id$ # from PLC.Faults import * @@ -24,16 +24,18 @@ 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"), + 'auth_type': Parameter(int, "Type of auth used. i.e. AuthMethod"), '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") + 'object_ids': Parameter([int], "IDs of objects affected by this event"), + 'object_types': Parameter([str], "What type of object were affected by this event") } - def add_object(self, object_id, commit = True): + def add_object(self, object_type, object_id, commit = True): """ Relate object to this event. """ @@ -46,8 +48,8 @@ class Event(Row): self['object_ids'] = [] if object_id not in self['object_ids']: - self.api.db.do("INSERT INTO event_object (event_id, object_id)" \ - " VALUES(%(event_id)d, %(object_id)d)", + self.api.db.do("INSERT INTO event_object (event_id, object_id, object_type)" \ + " VALUES(%(event_id)d, %(object_id)d, %(object_type)s)", locals()) if commit: @@ -71,6 +73,7 @@ class Events(Table): 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 += " AND (%s) %s" % event_filter.sql(api) +# with new filtering, caller needs to set this explicitly +# sql += " ORDER BY %s" % Event.primary_key self.selectall(sql)