def test_resolve_notification_url(self): notification = create( Builder('notification').id('123').having(userid='peter')) url = resolve_notification_url(notification) self.assertEquals( 'http://example.com/@@resolve_notification?notification_id=123', url)
def test_resolve_notification_url(self): notification = create(Builder('notification') .id('123') .having(userid='peter')) url = resolve_notification_url(notification) self.assertEquals( 'http://example.com/@@resolve_notification?notification_id=123', url)
def get_data(self, notification): language = self.get_users_language() return { 'subject': self.get_subject(notification), 'title': notification.activity.translations[language].title, 'label': notification.activity.translations[language].label, 'summary': notification.activity.translations[language].summary, 'description': notification.activity.translations[language].description, 'link': resolve_notification_url(notification), 'public_url': get_current_admin_unit().public_url, }
def prepare_html(self, notification): template = ViewPageTemplateFile("templates/notification.pt") language = self.get_users_language() options = { 'title': notification.activity.translations[language].title, 'label': notification.activity.translations[language].label, 'summary': notification.activity.translations[language].summary, 'description': notification.activity.translations[language].description, 'link': resolve_notification_url(notification) } return template(self, **options)
def prepare_html(self, notification): template = ViewPageTemplateFile("templates/notification.pt") language = self.get_users_language() options = { 'title': notification.activity.translations[language].title, 'label': notification.activity.translations[language].label, 'summary': notification.activity.translations[language].summary, 'description': notification.activity.translations[language].description, 'link': resolve_notification_url(notification) } return template(self, **options)
def dump_notifications(self, notifications): data = [] for notification in notifications: data.append({ 'title': notification.activity.title, 'label': notification.activity.label, 'summary': notification.activity.summary, 'created': notification.activity.created.astimezone( pytz.UTC).isoformat(), 'link': resolve_notification_url(notification), 'read': notification.is_read, 'id': notification.notification_id}) return data
def dump_notifications(self, notifications): data = [] for notification in notifications: data.append({ 'title': notification.activity.title, 'label': notification.activity.label, 'summary': notification.activity.summary, 'created': notification.activity.created.astimezone( pytz.UTC).isoformat(), 'link': resolve_notification_url(notification), 'target': self.get_link_target(notification), 'read': notification.is_read, 'id': notification.notification_id}) return data
def test_resolve_notification_url(self): self.assertEquals( 'http://nohost/plone/@@resolve_notification?notification_id=123', resolve_notification_url(self.notification), )
def resolve_notification_link(item, value): return u'<a href="{}">{}</a>'.format( resolve_notification_url(item).decode('ascii'), item.activity.title)
def resolve_notification_link(item, value): return u'<a href="{}">{}</a>'.format( resolve_notification_url(item).decode('ascii'), item.activity.title)
def test_resolve_notification_url(self): self.assertEquals( 'http://nohost/plone/@@resolve_notification?notification_id=123', resolve_notification_url(self.notification), )