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 UNLOCKED = 0 14 DELETE_LOCKED = 1 15 UPDATE_LOCKED = 2 1618 19 sendEventWhenBlockedFlag = False 20 modelerLock = UNLOCKED 2115023 if not obj: obj = self 24 if obj.getPrimaryParent() == self.getDmd(): 25 return None 26 elif isinstance(obj.getPrimaryParent(), Lockable): 27 return obj.getPrimaryParent() 28 else: 29 return self.getNextLockableParent(obj.getPrimaryParent())3032 if self.sendEventWhenBlockedFlag: 33 return True 34 return False 35 ''' 36 else: 37 lockableParent = self.getNextLockableParent() 38 if lockableParent: 39 return lockableParent.sendEventWhenBlocked() 40 else: 41 return False 42 '''43 4850 if (self.modelerLock == DELETE_LOCKED 51 or self.modelerLock == UPDATE_LOCKED): 52 return True 53 return False 54 ''' 55 else: 56 lockableParent = self.getNextLockableParent() 57 if lockableParent: 58 return lockableParent.isLockedFromDeletion() 59 else: 60 return False 61 '''6264 if self.modelerLock == UPDATE_LOCKED: 65 return True 66 return False 67 ''' 68 else: 69 lockableParent = self.getNextLockableParent() 70 if lockableParent: 71 return lockableParent.isLockedFromUpdates() 72 else: 73 return False 74 '''75 78 8183 """Unlock object""" 84 self.modelerLock = UNLOCKED 85 self.unsetSendEventWhenBlockedFlag() 86 87 if self.meta_type == 'Device': 88 for dc in self.getDeviceComponents(): 89 dc.unlock() 90 91 if REQUEST: 92 REQUEST['message'] = "Unlocked" 93 return self.callZenScreen(REQUEST)9496 """Lock object from being deleted""" 97 self.modelerLock = DELETE_LOCKED 98 if sendEventWhenBlocked: 99 self.setSendEventWhenBlockedFlag() 100 else: 101 self.unsetSendEventWhenBlockedFlag() 102 103 if self.meta_type == 'Device': 104 for dc in self.getDeviceComponents(): 105 dc.lockFromDeletion(sendEventWhenBlocked) 106 107 if REQUEST: 108 REQUEST['message'] = "Locked from deletion" 109 return self.callZenScreen(REQUEST)110112 """Lock object from being deleted or updated""" 113 self.modelerLock = UPDATE_LOCKED 114 if sendEventWhenBlocked: 115 self.setSendEventWhenBlockedFlag() 116 else: 117 self.unsetSendEventWhenBlockedFlag() 118 119 if self.meta_type == 'Device': 120 for dc in self.getDeviceComponents(): 121 dc.lockFromUpdates(sendEventWhenBlocked) 122 123 if REQUEST: 124 REQUEST['message'] = "Locked from updates and deletion" 125 return self.callZenScreen(REQUEST)126128 ''' 129 if self.modelerLock == DELETE_LOCKED: 130 return "Locked from deletion" 131 elif self.modelerLock == UPDATE_LOCKED: 132 return "Locked from updates and deletion" 133 elif isinstance(self.getPrimaryParent(), Lockable): 134 return "%s by parent" % self.getPrimaryParent().lockStatus() 135 elif self.modelerLock == UNLOCKED: 136 return "Unlocked" 137 ''' 138 if self.isLockedFromUpdates(): 139 return "locked from updates and deletion" 140 elif self.isLockedFromDeletion(): 141 return "locked from deletion" 142 else: 143 return "unlocked"144146 if self.sendEventWhenBlocked(): 147 return "Send event when blocked" 148 else: 149 return "Do not send event when blocked"
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Thu Oct 25 16:28:22 2007 | http://epydoc.sourceforge.net |