Package ZenModel :: Module MibBase
[hide private]
[frames] | no frames]

Source Code for Module ZenModel.MibBase

 1  ########################################################################### 
 2  # 
 3  # This program is part of Zenoss Core, an open source monitoring platform. 
 4  # Copyright (C) 2007, Zenoss Inc. 
 5  # 
 6  # This program is free software; you can redistribute it and/or modify it 
 7  # under the terms of the GNU General Public License version 2 as published by 
 8  # the Free Software Foundation. 
 9  # 
10  # For complete information please visit: http://www.zenoss.com/oss/ 
11  # 
12  ########################################################################### 
13   
14  from ZenModelRM import ZenModelRM 
15  from ZenPackable import ZenPackable 
16   
17 -class MibBase(ZenModelRM, ZenPackable):
18 19 default_catalog = 'mibSearch' 20 21 _relations = ZenPackable._relations[:] 22 23 moduleName = "" 24 nodetype = "" 25 oid = "" 26 status = "" 27 description = "" 28 29 _properties = ( 30 {'id':'moduleName', 'type':'string', 'mode':'w'}, 31 {'id':'nodetype', 'type':'string', 'mode':'w'}, 32 {'id':'oid', 'type':'string', 'mode':'w'}, 33 {'id':'status', 'type':'string', 'mode':'w'}, 34 {'id':'description', 'type':'string', 'mode':'w'}, 35 ) 36 37
38 - def __init__(self, id, title="", **kwargs):
39 super(ZenModelRM, self).__init__(id, title) 40 atts = self.propertyIds() 41 for key, val in kwargs.items(): 42 if key in atts: setattr(self, key, val)
43 44
45 - def getFullName(self):
46 """Return full value name in form MODULE::attribute. 47 """ 48 return "%s::%s" % (self.moduleName, self.id)
49 50
51 - def summary(self):
52 """Return summary string for Mib objects. 53 """ 54 return [str(getattr(self, p)) for p in self.propertyIds() \ 55 if str(getattr(self, p))]
56 57
58 - def manage_afterAdd(self, item, container):
59 """ 60 Device only propagates afterAdd if it is the added object. 61 """ 62 super(MibBase,self).manage_afterAdd(item, container) 63 self.index_object()
64 65
66 - def manage_afterClone(self, item):
67 """Not really sure when this is called.""" 68 super(MibBase,self).manage_afterClone(item) 69 self.index_object()
70 71
72 - def manage_beforeDelete(self, item, container):
73 """ 74 Device only propagates beforeDelete if we are being deleted or copied. 75 Moving and renaming don't propagate. 76 """ 77 super(MibBase,self).manage_beforeDelete(item, container) 78 self.unindex_object()
79