Package ZenModel :: Module DeviceManagerBase
[hide private]
[frames] | no frames]

Source Code for Module ZenModel.DeviceManagerBase

 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  import types 
15  from ZenossSecurity import ZEN_VIEW 
16   
17 -class DeviceManagerBase:
18 """ 19 Default implementation of IDeviceManager interface. This interface 20 is implemented by classes that have a device relationship to allow them 21 to manage their device relations. 22 """ 23
24 - def getDevices(self):
25 return [ dev for dev in self.devices() 26 if self.checkRemotePerm(ZEN_VIEW, dev)]
27
28 - def deviceMoveTargets(self):
29 """see IManageDevice""" 30 raise NotImplementedError
31
32 - def removeDevices(self, deviceNames=None, REQUEST=None):
33 """see IManageDevice""" 34 if not deviceNames: return self() 35 if type(deviceNames) in types.StringTypes: deviceNames = (deviceNames,) 36 for devname in deviceNames: 37 self.devices._delObject(devname) 38 if REQUEST: 39 return self()
40