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

Source Code for Module Products.ZenModel.NotificationSubscriptionWindow

 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 or (at your 
 8  # option) any later version as published by the Free Software Foundation. 
 9  # 
10  # For complete information please visit: http://www.zenoss.com/oss/ 
11  # 
12  ########################################################################### 
13   
14  import logging 
15   
16  log = logging.getLogger("zen.notificationwindows") 
17   
18  import time 
19  from Products.ZenRelations.RelSchema import * 
20  from Products.ZenModel.MaintenanceWindow import MaintenanceWindow 
21   
22 -class NotificationSubscriptionWindow(MaintenanceWindow):
23 24 notificationSubscription = None 25 26 _relations = MaintenanceWindow._relations + ( 27 ("notificationSubscription", 28 ToOne( 29 ToManyCont, 30 "Products.ZenModel.NotificationSubscription", 31 "windows" 32 )), 33 ) 34 35 _properties = tuple(list(MaintenanceWindow._properties) + [ 36 {'id':'enabled', 'type':'boolean', 'mode':'w'} 37 ]) 38
39 - def target(self):
40 return self.notificationSubscription()
41
42 - def begin(self, now=None):
43 if self.started is not None: 44 log.debug('Notification Subscription Window is trying to begin after' 45 ' it is already started: Start: %s, Duration: %s' % (self.started, self.duration)) 46 47 self.target().enabled = True 48 if not now: 49 now = time.time() 50 self.started = now
51
52 - def end(self):
53 self.started = None 54 self.target().enabled = False
55