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