sobjects/notification.py
branchstable
changeset 3004 09ab5e93a02c
parent 2879 ae26a80c0635
child 3023 7864fee8b4ec
child 3045 82e0b12054a8
equal deleted inserted replaced
3001:74e842e4871a 3004:09ab5e93a02c
    74             view = session.vreg['views'].select('notif_status_change', session,
    74             view = session.vreg['views'].select('notif_status_change', session,
    75                                                 rset=rset, row=0)
    75                                                 rset=rset, row=0)
    76         except RegistryException:
    76         except RegistryException:
    77             return
    77             return
    78         comment = entity.printable_value('comment', format='text/plain')
    78         comment = entity.printable_value('comment', format='text/plain')
    79         if comment:
    79         # XXX don't try to wrap rest until we've a proper transformation (see
    80             comment = normalize_text(comment, 80,
    80         # #103822)
    81                                      rest=entity.comment_format=='text/rest')
    81         if comment and entity.comment_format != 'text/rest':
       
    82             comment = normalize_text(comment, 80)
    82         RenderAndSendNotificationView(session, view=view, viewargs={
    83         RenderAndSendNotificationView(session, view=view, viewargs={
    83             'comment': comment, 'previous_state': entity.previous_state.name,
    84             'comment': comment, 'previous_state': entity.previous_state.name,
    84             'current_state': entity.new_state.name})
    85             'current_state': entity.new_state.name})
    85 
    86 
    86 
    87 
   173 
   174 
   174     def context(self, **kwargs):
   175     def context(self, **kwargs):
   175         entity = self.entity(self.row or 0, self.col or 0)
   176         entity = self.entity(self.row or 0, self.col or 0)
   176         content = entity.printable_value(self.content_attr, format='text/plain')
   177         content = entity.printable_value(self.content_attr, format='text/plain')
   177         if content:
   178         if content:
   178             contentformat = getattr(entity, self.content_attr + '_format', 'text/rest')
   179             contentformat = getattr(entity, self.content_attr + '_format',
   179             content = normalize_text(content, 80, rest=contentformat=='text/rest')
   180                                     'text/rest')
       
   181             # XXX don't try to wrap rest until we've a proper transformation (see
       
   182             # #103822)
       
   183             if contentformat != 'text/rest':
       
   184                 content = normalize_text(content, 80)
   180         return super(ContentAddedView, self).context(content=content, **kwargs)
   185         return super(ContentAddedView, self).context(content=content, **kwargs)
   181 
   186 
   182     def subject(self):
   187     def subject(self):
   183         entity = self.entity(self.row or 0, self.col or 0)
   188         entity = self.entity(self.row or 0, self.col or 0)
   184         return  u'%s #%s (%s)' % (self.req.__('New %s' % entity.e_schema),
   189         return  u'%s #%s (%s)' % (self.req.__('New %s' % entity.e_schema),