Package Products :: Package ZenModel :: Module NotificationSubscriptionWindow
[hide private]
[frames] | no frames]

Source Code for Module Products.ZenModel.NotificationSubscriptionWindow

 1  ############################################################################## 
 2  #  
 3  # Copyright (C) Zenoss, Inc. 2007, all rights reserved. 
 4  #  
 5  # This content is made available according to terms specified in 
 6  # License.zenoss under the directory where your Zenoss product is installed. 
 7  #  
 8  ############################################################################## 
 9   
10   
11  import logging 
12   
13  log = logging.getLogger("zen.notificationwindows") 
14   
15  import time 
16  from Products.ZenRelations.RelSchema import * 
17  from Products.ZenModel.MaintenanceWindow import MaintenanceWindow 
18   
19 -class NotificationSubscriptionWindow(MaintenanceWindow):
20 21 notificationSubscription = None 22 23 backCrumb = "triggers" 24 25 _relations = MaintenanceWindow._relations + ( 26 ("notificationSubscription", 27 ToOne( 28 ToManyCont, 29 "Products.ZenModel.NotificationSubscription", 30 "windows" 31 )), 32 ) 33 34 _properties = tuple(list(MaintenanceWindow._properties) + [ 35 {'id':'enabled', 'type':'boolean', 'mode':'w'} 36 ]) 37
38 - def target(self):
39 return self.notificationSubscription()
40
41 - def begin(self, now=None):
42 if self.started is not None: 43 log.debug('Notification Subscription Window is trying to begin after' 44 ' it is already started: Start: %s, Duration: %s' % (self.started, self.duration)) 45 46 self.target().enabled = True 47 if not now: 48 now = time.time() 49 self.started = now
50
51 - def end(self):
52 self.started = None 53 self.target().enabled = False
54