~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/answers/model/question.py

Merge db-devel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
    SQLBase,
61
61
    sqlvalues,
62
62
    )
63
 
from canonical.launchpad.database.message import (
 
63
from lp.services.messages.model.message import (
64
64
    Message,
65
65
    MessageChunk,
66
66
    )
67
67
from canonical.launchpad.helpers import is_english_variant
68
68
from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
69
 
from canonical.launchpad.interfaces.message import IMessage
 
69
from lp.services.messages.interfaces.message import IMessage
70
70
from lp.answers.interfaces.faq import IFAQ
71
71
from lp.answers.interfaces.question import (
72
72
    InvalidQuestionStateError,
109
109
    IProduct,
110
110
    IProductSet,
111
111
    )
112
 
from lp.registry.interfaces.sourcepackage import ISourcePackage
113
112
from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
114
113
from lp.services.mail.notificationrecipientset import NotificationRecipientSet
115
114
from lp.services.propertycache import cachedproperty
235
234
            self.product = question_target
236
235
            self.distribution = None
237
236
            self.sourcepackagename = None
238
 
        # XXX sinzui 2007-04-20 bug=108240
239
 
        # We test for ISourcePackage because it is a valid QuestionTarget even
240
 
        # though it should not be. SourcePackages are never passed to this
241
 
        # mutator.
242
 
        elif (ISourcePackage.providedBy(question_target) or
243
 
                IDistributionSourcePackage.providedBy(question_target)):
 
237
        elif (IDistributionSourcePackage.providedBy(question_target)):
244
238
            self.product = None
245
239
            self.distribution = question_target.distribution
246
240
            self.sourcepackagename = question_target.sourcepackagename
904
898
        particular person."""
905
899
        joins = [
906
900
            ("""LEFT OUTER JOIN QuestionMessage
907
 
                ON QuestionMessage.question = Question.id"""),
908
 
            ("""LEFT OUTER JOIN Message
909
 
                ON QuestionMessage.message = Message.id
910
 
                AND Message.owner = %s""" % sqlvalues(person))]
 
901
                ON QuestionMessage.question = Question.id
 
902
                AND QuestionMessage.owner = %s""" % sqlvalues(person))]
911
903
        if self.project:
912
904
            joins.extend(self.getProductJoins())
913
905
 
938
930
                    AND Question.status IN %(owner_status)s)
939
931
                OR (Question.owner != %(person)s AND
940
932
                    Question.status = %(open_status)s AND
941
 
                    Message.owner = %(person)s)
 
933
                    QuestionMessage.owner = %(person)s)
942
934
                )''' % sqlvalues(
943
935
                    person=self.needs_attention_from,
944
936
                    owner_status=[
1149
1141
        QuestionParticipation.ANSWERER: "Question.answerer = %s",
1150
1142
        QuestionParticipation.SUBSCRIBER: "QuestionSubscription.person = %s",
1151
1143
        QuestionParticipation.OWNER: "Question.owner = %s",
1152
 
        QuestionParticipation.COMMENTER: "Message.owner = %s",
 
1144
        QuestionParticipation.COMMENTER: "QuestionMessage.owner = %s",
1153
1145
        QuestionParticipation.ASSIGNEE: "Question.assignee = %s"}
1154
1146
 
1155
1147
    def getConstraints(self):
1233
1225
            return False
1234
1226
        return True
1235
1227
 
1236
 
    def findSimilarQuestions(self, title):
 
1228
    def findSimilarQuestions(self, phrase):
1237
1229
        """See `IQuestionTarget`."""
1238
1230
        return SimilarQuestionsSearch(
1239
 
            title, **self.getTargetTypes()).getResults()
 
1231
            phrase, **self.getTargetTypes()).getResults()
1240
1232
 
1241
1233
    def getQuestionLanguages(self):
1242
1234
        """See `IQuestionTarget`."""