Пример #1
0
    def searchResults(self):
        """Return the questions corresponding to the search."""
        if self.search_params is None:
            # Search button wasn't clicked, use the default filter.
            # Copy it so that it doesn't get mutated accidently.
            self.search_params = dict(self.getDefaultFilter())

        # The search parameters used is defined by the union of the fields
        # present in ISearchQuestionsForm (search_text, status, sort) and the
        # ones defined in getDefaultFilter() which varies based on the
        # concrete view class.
        question_collection = IQuestionCollection(self.context)
        return BatchNavigator(question_collection.searchQuestions(**self.search_params), self.request)
Пример #2
0
    def searchResults(self):
        """Return the questions corresponding to the search."""
        if self.search_params is None:
            # Search button wasn't clicked, use the default filter.
            # Copy it so that it doesn't get mutated accidently.
            self.search_params = dict(self.getDefaultFilter())

        # The search parameters used is defined by the union of the fields
        # present in ISearchQuestionsForm (search_text, status, sort) and the
        # ones defined in getDefaultFilter() which varies based on the
        # concrete view class.
        question_collection = IQuestionCollection(self.context)
        return BatchNavigator(
            question_collection.searchQuestions(**self.search_params),
            self.request)
Пример #3
0
 def context_question_languages(self):
     """Return the set of ILanguages used by this context's questions."""
     question_collection = IQuestionCollection(self.context)
     return question_collection.getQuestionLanguages()
Пример #4
0
 def getLatestQuestions(self, quantity=5):
     """Return <quantity> latest questions created for this target. This
     is used by the +portlet-latestquestions view.
     """
     question_collection = IQuestionCollection(self.context)
     return list(question_collection.searchQuestions()[:quantity])
Пример #5
0
 def __call__(self):
     questiontarget = IQuestionCollection(self.context)
     open_questions = questiontarget.searchQuestions(
         status=[QuestionStatus.OPEN, QuestionStatus.NEEDSINFO])
     return unicode(open_questions.count())
Пример #6
0
 def context_question_languages(self):
     """Return the set of ILanguages used by this context's questions."""
     question_collection = IQuestionCollection(self.context)
     return question_collection.getQuestionLanguages()
Пример #7
0
 def __call__(self):
     questiontarget = IQuestionCollection(self.context)
     open_questions = questiontarget.searchQuestions(status=[QuestionStatus.OPEN, QuestionStatus.NEEDSINFO])
     return unicode(open_questions.count())
Пример #8
0
 def getLatestQuestions(self, quantity=5):
     """Return <quantity> latest questions created for this target. This
     is used by the +portlet-latestquestions view.
     """
     question_collection = IQuestionCollection(self.context)
     return list(question_collection.searchQuestions()[:quantity])