Trees | Indices | Help |
|
---|
|
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 __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 3032 """make a Hardware""" 33 d = Hardware(id, title) 34 context._setObject(id, d) 35 36 if REQUEST is not None: 37 REQUEST['RESPONSE'].redirect(context.absolute_url() 38 +'/manage_main')39 40 addHardware = DTMLFile('dtml/addHardware',globals()) 4143 """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')88 89 90 InitializeClass(Hardware) 9157 - def setProduct(self, productName, manufacturer="Unknown", 58 newProductName="", REQUEST=None, **kwargs):59 """Set the product class of this software. 60 """ 61 if not manufacturer: manufacturer = "Unknown" 62 if newProductName: productName = newProductName 63 prodobj = self.getDmdRoot("Manufacturers").createHardwareProduct( 64 productName, manufacturer, **kwargs) 65 self.productClass.addRelation(prodobj) 66 if REQUEST: 67 messaging.IMessageSender(self).sendToBrowser( 68 'Product Set', 69 'Manufacturer %s and product %s set.' % (manufacturer, 70 productName) 71 ) 72 return self.callZenScreen(REQUEST)73 7476 """Set the product class of this software by its productKey. 77 """ 78 if prodKey: 79 manufs = self.getDmdRoot("Manufacturers") 80 prodobj = manufs.createHardwareProduct(prodKey, manufacturer) 81 self.productClass.addRelation(prodobj) 82 else: 83 self.productClass.removeRelation()84 85
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Thu May 7 11:46:32 2009 | http://epydoc.sourceforge.net |