def register_module(): """Registers the module with the Registry.""" def on_module_enabled(): dashboard.filer.ALLOWED_ASSET_TEXT_BASES = ( dashboard.filer.ALLOWED_ASSET_TEXT_BASES.union( ['views/notifications'])) def on_module_disabled(): dashboard.filer.ALLOWED_ASSET_TEXT_BASES = ( dashboard.filer.ALLOWED_ASSET_TEXT_BASES.difference( ['views/notifications'])) global custom_module # pylint: disable=global-statement # Avert circular dependency. pylint: disable=g-import-not-at-top from modules.notifications import cron from modules.notifications import stats stats.register_analytic() cron_handlers = [('/cron/process_pending_notifications', cron.ProcessPendingNotificationsHandler)] custom_module = custom_modules.Module( 'Notifications', 'Student notification management system.', cron_handlers, [], notify_module_disabled=on_module_disabled, notify_module_enabled=on_module_enabled) class Service(services.Notifications): def enabled(self): return custom_module.enabled def query(self, to, intent): return Manager.query(to, intent) def send_async(self, to, sender, intent, body, subject, audit_trail=None, html=None, retention_policy=None): return Manager.send_async(to, sender, intent, body, subject, audit_trail=audit_trail, html=html, retention_policy=retention_policy) services.notifications = Service() return custom_module
def register_module(): """Registers the module with the Registry.""" def on_module_enabled(): asset_paths.AllowedBases.add_text_base('views/notifications') data_removal.Registry.register_indexed_by_email_remover( Notification.delete_by_to_email) data_removal.Registry.register_indexed_by_email_remover( Payload.delete_by_to_email) global custom_module # pylint: disable=global-statement # Avert circular dependency. pylint: disable=g-import-not-at-top from modules.notifications import cron from modules.notifications import stats stats.register_analytic() cron_handlers = [('/cron/process_pending_notifications', cron.ProcessPendingNotificationsHandler)] custom_module = custom_modules.Module( 'Notifications', 'Student notification management system.', cron_handlers, [], notify_module_enabled=on_module_enabled) class Service(services.Notifications): def enabled(self): return custom_module.enabled def query(self, to, intent): return Manager.query(to, intent) def send_async(self, to, sender, intent, body, subject, audit_trail=None, html=None, retention_policy=None): return Manager.send_async(to, sender, intent, body, subject, audit_trail=audit_trail, html=html, retention_policy=retention_policy) services.notifications = Service() return custom_module
def register_module(): """Registers the module with the Registry.""" def on_module_enabled(): dashboard.filer.ALLOWED_ASSET_TEXT_BASES = ( dashboard.filer.ALLOWED_ASSET_TEXT_BASES.union( ['views/notifications'])) def on_module_disabled(): dashboard.filer.ALLOWED_ASSET_TEXT_BASES = ( dashboard.filer.ALLOWED_ASSET_TEXT_BASES.difference( ['views/notifications'])) global custom_module # pylint: disable=global-statement # Avert circular dependency. pylint: disable=g-import-not-at-top from modules.notifications import cron from modules.notifications import stats stats.register_analytic() cron_handlers = [( '/cron/process_pending_notifications', cron.ProcessPendingNotificationsHandler )] custom_module = custom_modules.Module( 'Notifications', 'Student notification management system.', cron_handlers, [], notify_module_disabled=on_module_disabled, notify_module_enabled=on_module_enabled ) class Service(services.Notifications): def enabled(self): return custom_module.enabled def query(self, to, intent): return Manager.query(to, intent) def send_async( self, to, sender, intent, body, subject, audit_trail=None, html=None, retention_policy=None): return Manager.send_async( to, sender, intent, body, subject, audit_trail=audit_trail, html=html, retention_policy=retention_policy) services.notifications = Service() return custom_module
def register_module(): """Registers the module with the Registry.""" def on_module_enabled(): asset_paths.AllowedBases.add_text_base('views/notifications') data_removal.Registry.register_indexed_by_email_remover( Notification.delete_by_to_email) data_removal.Registry.register_indexed_by_email_remover( Payload.delete_by_to_email) global custom_module # pylint: disable=global-statement # Avert circular dependency. pylint: disable=g-import-not-at-top from modules.notifications import cron from modules.notifications import stats stats.register_analytic() cron_handlers = [( '/cron/process_pending_notifications', cron.ProcessPendingNotificationsHandler )] custom_module = custom_modules.Module( 'Notifications', 'Student notification management system.', cron_handlers, [], notify_module_enabled=on_module_enabled ) class Service(services.Notifications): def enabled(self): return custom_module.enabled def query(self, to, intent): return Manager.query(to, intent) def send_async( self, to, sender, intent, body, subject, audit_trail=None, html=None, retention_policy=None): return Manager.send_async( to, sender, intent, body, subject, audit_trail=audit_trail, html=html, retention_policy=retention_policy) services.notifications = Service() return custom_module