def getMessageBodies(self): """Creates a structure for a thread tree""" if self.flat: message = messageStructure(self.context, sub_mgr=self.getSubManager(), full_message=True) message['children'] = [] results = self.search.getMessageReferrers(self.context.message_id, reversed=self.newest_first) for msg in results: child = messageStructure(msg, sub_mgr=self.getSubManager(), full_message=True) child['children']=[] message['children'].append(child) return message # If the method was already called it should be cached, use it. If # not call it and cache it. reply_struct = self._reply_cache if reply_struct is None: try: reply_struct = createReplyStructureFromReferrers( self.context, self.search, full_message=True, sub_mgr=self.getSubManager(), newest_first=self.newest_first) except KeyError: # This happens when we have parentless messages in the # thread. Fall back to the equivalent, but slower, # way of creating the structure. reply_struct = createReplyStructure( self.context, self.search, full_message=True, sub_mgr=self.getSubManager()) # Cache this in case we need it for the thread display self._reply_cache = reply_struct return reply_struct
def getReplyStructure(self): """Creates a structure for a thread tree, use cache generated from getMessageBodies if possible, as they may each be run.""" reply_struct = self._reply_cache if reply_struct is None: try: # Use the more efficient method reply_struct = createReplyStructureFromReferrers(self.context, self.search, sub_mgr=self.getSubManager(), newest_first=self.newest_first) except KeyError: reply_struct = createReplyStructure( self.context, self.search, sub_mgr=self.getSubManager()) self._reply_cache = reply_struct return reply_struct
def getReplyStructure(self): """Creates a structure for a thread tree, use cache generated from getMessageBodies if possible, as they may each be run.""" reply_struct = self._reply_cache if reply_struct is None: try: # Use the more efficient method reply_struct = createReplyStructureFromReferrers( self.context, self.search, sub_mgr=self.getSubManager(), newest_first=self.newest_first) except KeyError: reply_struct = createReplyStructure( self.context, self.search, sub_mgr=self.getSubManager()) self._reply_cache = reply_struct return reply_struct
def getMessageBodies(self): """Creates a structure for a thread tree""" if self.flat: message = messageStructure(self.context, sub_mgr=self.getSubManager(), full_message=True) message['children'] = [] results = self.search.getMessageReferrers( self.context.message_id, reversed=self.newest_first) for msg in results: child = messageStructure(msg, sub_mgr=self.getSubManager(), full_message=True) child['children'] = [] message['children'].append(child) return message # If the method was already called it should be cached, use it. If # not call it and cache it. reply_struct = self._reply_cache if reply_struct is None: try: reply_struct = createReplyStructureFromReferrers( self.context, self.search, full_message=True, sub_mgr=self.getSubManager(), newest_first=self.newest_first) except KeyError: # This happens when we have parentless messages in the # thread. Fall back to the equivalent, but slower, # way of creating the structure. reply_struct = createReplyStructure( self.context, self.search, full_message=True, sub_mgr=self.getSubManager()) # Cache this in case we need it for the thread display self._reply_cache = reply_struct return reply_struct
def getReplyStructure(self): """Creates a structure for a thread tree""" return createReplyStructure(self.context, self.search, sub_mgr=self.getSubManager())