l.s.w.n.NotificationList(list) : class documentation

Part of lp.services.webapp.notifications View In Hierarchy

Collection of INotification instances with a creation date

>>> notifications = NotificationList()
>>> notifications.created <= datetime.utcnow()
>>> 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
def __init__(self):
def __getitem__(self, index_or_levelname):
API Documentation for Launchpad, generated by pydoctor at 2020-09-29 00:00:05.