# HG changeset patch # User Thierry Florac # Date 1499854388 -7200 # Node ID 9c4f1c59827274bb3093cc4b786f21be74efc918 # Parent eb863d6bc5a983b0bbda4a6f18405e9e014f8703 Use new notifications API diff -r eb863d6bc5a9 -r 9c4f1c598272 src/pyams_notify/viewlet/__init__.py --- a/src/pyams_notify/viewlet/__init__.py Wed Jul 12 12:12:08 2017 +0200 +++ b/src/pyams_notify/viewlet/__init__.py Wed Jul 12 12:13:08 2017 +0200 @@ -16,10 +16,12 @@ # 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 @@ -39,3 +41,10 @@ @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) + + def get_notifications(self): + return get_user_notifications(self.cache_server, self.request) diff -r eb863d6bc5a9 -r 9c4f1c598272 src/pyams_notify/viewlet/templates/notifications.pt --- a/src/pyams_notify/viewlet/templates/notifications.pt Wed Jul 12 12:12:08 2017 +0200 +++ b/src/pyams_notify/viewlet/templates/notifications.pt Wed Jul 12 12:13:08 2017 +0200 @@ -1,5 +1,20 @@
-

No notification to display.

- +

No notification to display.

+