Beispiel #1
0
 def display(self, context, request, notification):
     where = notification.where.encode('utf-8')
     self.what = translate(_h(notification.what), context=request)
     if context is not None:
         try:
             title = context.restrictedTraverse(where).Title()
         except KeyError:
             self.where = where.split('/')[-1]
         except AttributeError:
             self.where = where
         else:
             try:
                 self.where = title.decode('utf-8')
             except UnicodeEncodeError:
                 self.where = title
     else:
         self.where = where.split('/')[-1]
     for index, who in enumerate(notification.who):
         user = GetMemberInfoView(getSite(), request)
         user(who)
         if user is not None and user.fullname is not None:
             notification.who[index] = user.fullname.decode('utf-8')
     self.who = u', '.join(notification.who)
     self.plural = True if len(notification.who) > 1 else False
     if self.plural:
         return _w(u"${who} have ${what} ${where}",
                   mapping={
                       'who': self.who,
                       'what': self.what,
                       'where': self.where
                   })
     else:
         return _w(u"${who} has ${what} ${where}",
                   mapping={
                       'who': self.who,
                       'what': self.what,
                       'where': self.where
                   })
 def display(self, context, request, notification):
     self.what = translate(_h(notification.what.decode("utf-8")),
                           domain="collective.history", context=request)
     where = notification.where.encode('utf-8')
     if context is not None:
         title = context.Title()
         self.where = title.decode('utf-8')
     else:
         self.where = where.split('/')[-1]
     self.who = ', '.join(notification.who)
     self.plural = True if len(notification.who) > 1 else False
     if self.plural:
         return _(u"${who} have ${what} ${where}",
                  mapping={'who': self.who,
                           'what': self.what,
                           'where': self.where
                           })
     else:
         return _(u"${who} has ${what} ${where}",
                  mapping={'who': self.who,
                           'what': self.what,
                           'where': self.where
                           })
 def display(self, context, request, notification):
     where = notification.where.encode('utf-8')
     self.what = translate(_h(notification.what), context=request)
     if context is not None:
         try:
             title = context.restrictedTraverse(where).Title()
         except KeyError:
             self.where = where.split('/')[-1]
         except AttributeError:
             self.where = where
         else:
             try:
                 self.where = title.decode('utf-8')
             except UnicodeEncodeError:
                 self.where = title
     else:
         self.where = where.split('/')[-1]
     for index, who in enumerate(notification.who):
         user = GetMemberInfoView(getSite(), request)
         user(who)
         if user is not None and user.fullname is not None:
             notification.who[index] = user.fullname.decode('utf-8')
     self.who = u', '.join(notification.who)
     self.plural = True if len(notification.who) > 1 else False
     if self.plural:
         return _w(u"${who} have ${what} ${where}",
                   mapping={'who': self.who,
                            'what': self.what,
                            'where': self.where
                            })
     else:
         return _w(u"${who} has ${what} ${where}",
                   mapping={'who': self.who,
                            'what': self.what,
                            'where': self.where
                            })
Beispiel #4
0
class FavoritingRemovedFromFavorites(BaseHistoryAdapter):
    component.adapts(IRemovedFromFavoritesEvent)
    what = _h(u'unfavorited')
Beispiel #5
0
class FavoritingAddedToFavorites(BaseHistoryAdapter):
    component.adapts(IAddedToFavoritesEvent)
    what = _h(u'favorited')
Beispiel #6
0
class CioppinoUndislike(BaseHistoryAdapter):
    component.adapts(IUndislikeEvent)
    what = _h(u'undisliked')
Beispiel #7
0
class CioppinoLike(BaseHistoryAdapter):
    component.adapts(ILikeEvent)
    what = _h(u'liked')