Example #1
0
 def display(self, context, request, notification):
     super(AddedDisplay, self).display(context, request, notification)
     #  For comment. Possibly for more things ?
     if context is not None:
         try:
             where = notification.where.encode('utf-8')
             comment = context.restrictedTraverse(where)
             title = comment.__parent__.__parent__.Title()
         except KeyError:
             pass
         except AttributeError:
             pass
         else:
             try:
                 self.where = title.decode('utf-8')
             except UnicodeEncodeError:
                 self.where = title
     if self.plural:
         return _w(u"${who} have commented ${where}",
                   mapping={
                       'who': self.who,
                       'where': self.where
                   })
     else:
         return _w(u"${who} has commented ${where}",
                   mapping={
                       'who': self.who,
                       'where': self.where
                   })
Example #2
0
 def display(self, context, request, notification):
     super(AddedDisplay, self).display(context, request, notification)
     #  For comment. Possibly for more things ?
     if context is not None:
         try:
             where = notification.where.encode('utf-8')
             comment = context.restrictedTraverse(where)
             title = comment.__parent__.__parent__.Title()
         except KeyError:
             pass
         except AttributeError:
             pass
         else:
             try:
                 self.where = title.decode('utf-8')
             except UnicodeEncodeError:
                 self.where = title
     if self.plural:
         return _w(u"${who} have commented ${where}",
                   mapping={'who': self.who,
                            'where': self.where})
     else:
         return _w(u"${who} has commented ${where}",
                   mapping={'who': self.who,
                            'where': self.where})
Example #3
0
 def display(self, context, request, notification):
     super(StateChangedDisplay, self).display(context,
                                              request,
                                              notification)
     try:
         transition = notification.info['transition']
     except:
         transition = None
     if transition is None:
         if self.plural:
             return _w(u"${who} have changed ${where}'s state",
                       mapping={'who': self.who,
                                'where': self.where})
         else:
             return _w(u"${who} has changed ${where}'s state",
                       mapping={'who': self.who,
                                'where': self.where})
     transition = translate(_w(transition), context=request)
     if self.plural:
         return _w(u"${who} have ${transition} ${where}",
                   mapping={'who': self.who,
                            'transition': transition,
                            'where': self.where})
     else:
         return _w(u"${who} has ${transition} ${where}",
                   mapping={'who': self.who,
                            'transition': transition,
                            'where': self.where})
Example #4
0
 def display(self, context, request, notification):
     super(StateChangedDisplay, self).display(context, request,
                                              notification)
     try:
         transition = notification.info['transition']
     except:
         transition = None
     if transition is None:
         if self.plural:
             return _w(u"${who} have changed ${where}'s state",
                       mapping={
                           'who': self.who,
                           'where': self.where
                       })
         else:
             return _w(u"${who} has changed ${where}'s state",
                       mapping={
                           'who': self.who,
                           'where': self.where
                       })
     transition = translate(_w(transition), context=request)
     if self.plural:
         return _w(u"${who} have ${transition} ${where}",
                   mapping={
                       'who': self.who,
                       'transition': transition,
                       'where': self.where
                   })
     else:
         return _w(u"${who} has ${transition} ${where}",
                   mapping={
                       'who': self.who,
                       'transition': transition,
                       'where': self.where
                   })
Example #5
0
 def display(self, context, request, notification):
     super(RequestAccessInvitation, self).display(context, request,
                                                  notification)
     mapping = {'who': self.who}
     if self.plural:
         return _w(u"${who} have sent you invitations", mapping=mapping)
     else:
         return _w(u"${who} has sent you an invitation", mapping=mapping)
Example #6
0
 def display(self, context, request, notification):
     super(UnfavoritedDisplay, self).display(context, request, notification)
     if self.plural:
         return _w(u"${who} have removed ${where} from their favorites",
                   mapping={'who': self.who,
                            'where': self.where})
     else:
         return _w(u"${who} has removed ${where} from his favorites",
                   mapping={'who': self.who,
                            'where': self.where})
Example #7
0
 def display(self, context, request, notification):
     super(LikedDisplay, self).display(context, request, notification)
     if self.plural:
         return _w(u"${who} like ${where}",
                   mapping={'who': self.who,
                            'where': self.where})
     else:
         return _w(u"${who} likes ${where}",
                   mapping={'who': self.who,
                            'where': self.where})
Example #8
0
 def display(self, context, request, notification):
     super(RequestAccessRequest, self).display(context, request,
                                               notification)
     mapping = {'who': self.who, 'where': self.where}
     if self.plural:
         return _w(u"${who} have requested access to ${where}",
                   mapping=mapping)
     else:
         return _w(u"${who} has requested access to ${where}",
                   mapping=mapping)
Example #9
0
 def display(self, context, request, notification):
     super(UndislikedDisplay, self).display(context, request, notification)
     if self.plural:
         return _w(u"${who} do not dislike ${where} anymore",
                   mapping={'who': self.who,
                            'where': self.where})
     else:
         return _w(u"${who} does not dislike ${where} anymore",
                   mapping={'who': self.who,
                            'where': self.where})
Example #10
0
 def display(self, context, request, notification):
     super(RequestAccessInvitation, self).display(context,
                                                  request,
                                                  notification)
     mapping = {
         'who': self.who
     }
     if self.plural:
         return _w(u"${who} have sent you invitations",
                   mapping=mapping)
     else:
         return _w(u"${who} has sent you an invitation",
                   mapping=mapping)
Example #11
0
 def display(self, context, request, notification):
     super(RequestAccessRefused, self).display(context, request,
                                               notification)
     mapping = {'who': self.who, 'where': self.where}
     if notification.where.endswith('@@my_requests_view'):
         if self.plural:
             return _w(u"${who} have refused your invitations",
                       mapping=mapping)
         else:
             return _w(u"${who} has refused your invitation",
                       mapping=mapping)
     else:
         return _w(u"Your request for ${where} has been refused",
                   mapping=mapping)
Example #12
0
 def display(self, context, request, notification):
     super(UnfavoritedDisplay, self).display(context, request, notification)
     if self.plural:
         return _w(u"${who} have removed ${where} from their favorites",
                   mapping={
                       'who': self.who,
                       'where': self.where
                   })
     else:
         return _w(u"${who} has removed ${where} from his favorites",
                   mapping={
                       'who': self.who,
                       'where': self.where
                   })
Example #13
0
 def display(self, context, request, notification):
     super(UndislikedDisplay, self).display(context, request, notification)
     if self.plural:
         return _w(u"${who} do not dislike ${where} anymore",
                   mapping={
                       'who': self.who,
                       'where': self.where
                   })
     else:
         return _w(u"${who} does not dislike ${where} anymore",
                   mapping={
                       'who': self.who,
                       'where': self.where
                   })
Example #14
0
 def display(self, context, request, notification):
     super(LikedDisplay, self).display(context, request, notification)
     if self.plural:
         return _w(u"${who} like ${where}",
                   mapping={
                       'who': self.who,
                       'where': self.where
                   })
     else:
         return _w(u"${who} likes ${where}",
                   mapping={
                       'who': self.who,
                       'where': self.where
                   })
Example #15
0
 def display(self, context, request, notification):
     super(RequestAccessRequest, self).display(context,
                                               request,
                                               notification)
     mapping = {
         'who': self.who,
         'where': self.where
     }
     if self.plural:
         return _w(u"${who} have requested access to ${where}",
                   mapping=mapping)
     else:
         return _w(u"${who} has requested access to ${where}",
                   mapping=mapping)
Example #16
0
 def display(self, context, request, notification):
     super(RequestAccessRefused, self).display(context,
                                               request,
                                               notification)
     mapping = {
         'who': self.who,
         'where': self.where
     }
     if notification.where.endswith('@@my_requests_view'):
         if self.plural:
             return _w(u"${who} have refused your invitations",
                       mapping=mapping)
         else:
             return _w(u"${who} has refused your invitation",
                       mapping=mapping)
     else:
         return _w(u"Your request for ${where} has been refused",
                   mapping=mapping)
Example #17
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
                   })
Example #18
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
                            })
Example #19
0
 def display(self, context, request, notification):
     super(WaitingForValidationDisplay, self).display(context,
                                                      request,
                                                      notification)
     return _w(u"${who} is waiting for validation",
               mapping={'who': self.who})
Example #20
0
 def display(self, context, request, notification):
     super(WaitingForValidationDisplay,
           self).display(context, request, notification)
     return _w(u"${who} is waiting for validation",
               mapping={'who': self.who})