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
26 from Products.ZenRelations.RelSchema import *
27
28 from MEProduct import MEProduct
29
38
39 addHardware = DTMLFile('dtml/addHardware',globals())
40
42 """Hardware object"""
43 portal_type = meta_type = 'Hardware'
44
45 tag = ""
46 serialNumber = ""
47
48 _properties = MEProduct._properties + (
49 {'id':'tag', 'type':'string', 'mode':'w'},
50 {'id':'serialNumber', 'type':'string', 'mode':'w'},
51 )
52
53 security = ClassSecurityInfo()
54
55 security.declareProtected('Change Device', 'setProduct')
56 - def setProduct(self, productName, manufacturer="Unknown",
57 newProductName="", REQUEST=None, **kwargs):
58 """Set the product class of this software.
59 """
60 if not manufacturer: manufacturer = "Unknown"
61 if newProductName: productName = newProductName
62 prodobj = self.getDmdRoot("Manufacturers").createHardwareProduct(
63 productName, manufacturer, **kwargs)
64 self.productClass.addRelation(prodobj)
65 if REQUEST:
66 REQUEST['message'] = ("Set Manufacturer %s and Product %s at time:"
67 % (manufacturer, productName))
68 return self.callZenScreen(REQUEST)
69
70
80
81
84
85
86 InitializeClass(Hardware)
87