Package Products :: Package ZenEvents :: Module ZEvent
[hide private]
[frames] | no frames]

Source Code for Module Products.ZenEvents.ZEvent

 1  ############################################################################## 
 2  #  
 3  # Copyright (C) Zenoss, Inc. 2007, all rights reserved. 
 4  #  
 5  # This content is made available according to terms specified in 
 6  # License.zenoss under the directory where your Zenoss product is installed. 
 7  #  
 8  ############################################################################## 
 9   
10   
11  from Globals import InitializeClass 
12  from AccessControl import ClassSecurityInfo 
13   
14  from Event import Event 
15   
16 -class ZEvent(Event):
17 """ 18 Event that lives in the zope context has zope security mechanisms and 19 url back to event manager 20 """ 21 security = ClassSecurityInfo() 22 security.setDefaultAccess("allow") 23
24 - def __init__(self, manager, fields, data, eventPermission=True):
25 Event.__init__(self) 26 self.updateFromFields(fields, data) 27 self._zem = manager.getId() 28 self._baseurl = manager.absolute_url_path() 29 self.eventPermission = eventPermission
30
31 - def getEventDetailHref(self):
32 """build an href to call the detail of this event""" 33 return "%s/viewEventFields?evid=%s" % (self._baseurl, self.evid)
34
35 - def getCssClass(self):
36 """return the css class name to be used for this event. 37 """ 38 __pychecker__='no-constCond' 39 value = self.severity < 0 and "unknown" or self.severity 40 acked = self.eventState > 0 and "acked" or "noack" 41 return "zenevents_%s_%s %s" % (value, acked, acked)
42
43 - def zem(self):
44 """return the id of our manager. 45 """ 46 return self._zem
47 48 InitializeClass(ZEvent) 49