Part of lp.services.webapp.notifications View In Hierarchy
Collection of INotification instances with a creation date
>>> notifications = NotificationList() >>> notifications.created <= datetime.utcnow() True >>> notifications[0] Traceback (most recent call last): ... IndexError: list index out of range
>>> debug = BrowserNotificationLevel.DEBUG >>> error = BrowserNotificationLevel.ERROR >>> notifications.append(Notification(error, u'An error')) >>> notifications.append(Notification(debug, u'A debug message')) >>> for notification in notifications: ... print repr(notification.message) u'An error' u'A debug message'
The __getitem__ method is also overloaded to allow TALES expressions to easily retrieve lists of notifications that match a particular notification level.
>>> for notification in notifications['debug']: ... print repr(notification.message) u'A debug message'
Method | __init__ | Undocumented |
Method | __getitem__ | Undocumented |