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

Source Code for Module Products.ZenModel.MibBase

 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 zope.interface import implements 
12   
13  from Products.ZenModel.interfaces import IIndexed 
14  from ZenModelRM import ZenModelRM 
15  from ZenPackable import ZenPackable 
16   
17 -class MibBase(ZenModelRM, ZenPackable):
18 implements(IIndexed) 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