Source code for pyams_notify.viewlet
#
# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
__docformat__ = 'restructuredtext'
# import standard library
# import interfaces
from pyams_notify.interfaces import CACHE_CONFIGURATION_KEY
from pyams_skin.interfaces.viewlet import IActivityViewletManager
from pyams_skin.layer import IPyAMSLayer
# import packages
from pyams_notify.views.notification import get_user_notifications
from pyams_skin.viewlet.activity import ActivityViewlet
from pyams_template.template import template_config
from pyams_viewlet.viewlet import viewlet_config
from pyams_notify import _
[docs]@viewlet_config(name='pyams.notifications', layer=IPyAMSLayer, manager=IActivityViewletManager)
@template_config(template='templates/notifications.pt', layer=IPyAMSLayer)
class NotificationsViewlet(ActivityViewlet):
"""Notifications viewlet"""
name = 'notifications'
label = _("Notifications")
url = 'PyAMS_notify.refreshNotifications'
@property
def notify_server(self):
return self.request.registry.settings.get('pyams_notify.tcp_handler')
@property
def cache_server(self):
return self.request.registry.settings.get(CACHE_CONFIGURATION_KEY)