~launchpad-pqm/launchpad/devel

12959.4.20 by Curtis Hovey
Created AddAnswerContactError.
1
# Copyright 2011 Canonical Ltd.  This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
4
__metaclass__ = type
5
__all__ = [
6
    'AddAnswerContactError',
13099.1.12 by Curtis Hovey
Added QuestionTargetError and FAQTargetError
7
    'FAQTargetError',
13099.1.7 by Curtis Hovey
Moved InvalidQuestionStateError to the errors module.
8
    'InvalidQuestionStateError',
13099.1.2 by Curtis Hovey
Added missing __all__ entry.
9
    'NotAnswerContactError',
13099.1.11 by Curtis Hovey
Changed generic error into NotMessageOwnerError and exported it.
10
    'NotMessageOwnerError',
13099.1.1 by Curtis Hovey
Added two subclasses to Value error that are exported to the API.
11
    'NotQuestionOwnerError',
13099.1.12 by Curtis Hovey
Added QuestionTargetError and FAQTargetError
12
    'QuestionTargetError',
12959.4.20 by Curtis Hovey
Created AddAnswerContactError.
13
    ]
14
15
import httplib
16
13228.3.9 by Francis J. Lacoste
Convert all webservice_error into error_status and use httplib constants.
17
from lazr.restful.declarations import error_status
18
19
20
@error_status(httplib.BAD_REQUEST)
12959.4.20 by Curtis Hovey
Created AddAnswerContactError.
21
class AddAnswerContactError(ValueError):
22
    """The person cannot be an answer contact.
23
24
    An answer contacts must be a valid user or team that has a preferred
25
    language.
26
    """
13228.3.9 by Francis J. Lacoste
Convert all webservice_error into error_status and use httplib constants.
27
28
29
@error_status(httplib.BAD_REQUEST)
13099.1.12 by Curtis Hovey
Added QuestionTargetError and FAQTargetError
30
class FAQTargetError(ValueError):
13099.1.14 by Curtis Hovey
Fixed grammar.
31
    """The target must be an `IFAQTarget`."""
13228.3.9 by Francis J. Lacoste
Convert all webservice_error into error_status and use httplib constants.
32
33
34
@error_status(httplib.BAD_REQUEST)
13099.1.11 by Curtis Hovey
Changed generic error into NotMessageOwnerError and exported it.
35
class InvalidQuestionStateError(ValueError):
36
    """Error raised when the question is in an invalid state.
37
38
    Error raised when a workflow action cannot be executed because the
39
    question would be in an invalid state.
40
    """
13228.3.9 by Francis J. Lacoste
Convert all webservice_error into error_status and use httplib constants.
41
42
43
@error_status(httplib.BAD_REQUEST)
13099.1.1 by Curtis Hovey
Added two subclasses to Value error that are exported to the API.
44
class NotAnswerContactError(ValueError):
45
    """The person must be an answer contact."""
13228.3.9 by Francis J. Lacoste
Convert all webservice_error into error_status and use httplib constants.
46
47
48
@error_status(httplib.BAD_REQUEST)
13099.1.11 by Curtis Hovey
Changed generic error into NotMessageOwnerError and exported it.
49
class NotMessageOwnerError(ValueError):
50
    """The person be the the message owner."""
13228.3.9 by Francis J. Lacoste
Convert all webservice_error into error_status and use httplib constants.
51
52
53
@error_status(httplib.BAD_REQUEST)
13099.1.1 by Curtis Hovey
Added two subclasses to Value error that are exported to the API.
54
class NotQuestionOwnerError(ValueError):
55
    """The person be the the question owner."""
13228.3.9 by Francis J. Lacoste
Convert all webservice_error into error_status and use httplib constants.
56
57
58
@error_status(httplib.BAD_REQUEST)
13099.1.12 by Curtis Hovey
Added QuestionTargetError and FAQTargetError
59
class QuestionTargetError(ValueError):
13099.1.14 by Curtis Hovey
Fixed grammar.
60
    """The target must be an `IQueastionTarget`."""