1
2
3
4
5
6
7
8
9
10
11
12
13
14 __doc__="""Hardware
15
16 Hardware represents a hardware vendor's product.
17
18 $Id: Hardware.py,v 1.5 2003/03/08 18:34:24 edahl Exp $"""
19
20 __version__ = "$Revision: 1.5 $"[11:-2]
21
22 from Globals import DTMLFile
23 from Globals import InitializeClass
24 from AccessControl import ClassSecurityInfo
25 from Products.ZenWidgets import messaging
26
27 from Products.ZenRelations.RelSchema import *
28
29 from MEProduct import MEProduct
30
39
40 addHardware = DTMLFile('dtml/addHardware',globals())
41
43 """Hardware object"""
44 portal_type = meta_type = 'Hardware'
45
46 tag = ""
47 serialNumber = ""
48
49 _properties = MEProduct._properties + (
50 {'id':'tag', 'type':'string', 'mode':'w'},
51 {'id':'serialNumber', 'type':'string', 'mode':'w'},
52 )
53
54 security = ClassSecurityInfo()
55
56 security.declareProtected('Change Device', 'setProduct')
57 - def setProduct(self, productName, manufacturer="Unknown",
58 newProductName="", REQUEST=None, **kwargs):
73
74
76 """Set the product class of this software by its productKey.
77 """
78 if prodKey:
79
80 self._prodKey = prodKey
81 self._manufacturer = manufacturer
82
83 if manufacturer is None:
84 manufacturer = 'Unknown'
85
86 manufs = self.getDmdRoot("Manufacturers")
87 prodobj = manufs.createHardwareProduct(prodKey, manufacturer)
88 self.productClass.addRelation(prodobj)
89 else:
90 self.productClass.removeRelation()
91
92
93 InitializeClass(Hardware)
94