コード例 #1
0
ファイル: listen.py プロジェクト: socialplanning/opencore
    def items(self, n_items=5):
        if hasattr(self,'_items'):
            # If the property already contains something, there's no need to
            # regenerate it.
            return self._items

        # set self._items to empty list in case we have
        # no results at all
        self._items = []

        all_msgs = []
        for ml_id in self.mlists:
            mlist = self.context._getOb(ml_id)
            if not mlist.can_view_archives(mlist.REQUEST):
                continue

            cat = get_utility_for_context(ISearchableArchive, mlist)
            # aq wrap since brains work better this way            
            cat = cat.__of__(mlist)
            msgs = cat(sort_limit=n_items,
                       sort_order='descending',
                       sort_on='modification_date')
            all_msgs.extend(msgs)
        all_msgs.sort(key=lambda x:x.modification_date, reverse=True)
        all_msgs = all_msgs[:n_items]

        for msg in all_msgs:
            mstruct = messageStructure(msg, sub_mgr=mlist)
            self.add_item(title=obfct(msg.subject),
                          description=obfct(msg.subject),
                          link='%s/forum_view' % mstruct['url'],
                          author=mstruct['mail_from'],
                          pubDate=msg.modification_date,
#                          context=mlist,
#                              byline='by',
#                              responses=response
                              )

        return self._items
コード例 #2
0
ファイル: view.py プロジェクト: socialplanning/opencore
 def obfuscate(self, email):
     # Non-managers should never be able to see email addresses.
     return obfct(email)
コード例 #3
0
 def mail_from(self):
     if self._mail_info is None:
         self._mail_info = getAddressInfo(self.context,
                                          self.getSubManager())
     return obfct(self._mail_info[1])
コード例 #4
0
 def Title(self):
     """An encoded title"""
     return obfct(encode(self.title, self))
コード例 #5
0
 def Title(self):
     """An encoded title"""
     return obfct(encode(self.title, self))
コード例 #6
0
 def mail_from(self):
     if self._mail_info is None:
         self._mail_info = getAddressInfo(self.context,
                                          self.getSubManager())
     return obfct(self._mail_info[1])