1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# Copyright 2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
__all__ = [
'AddAnswerContactError',
'FAQTargetError',
'InvalidQuestionStateError',
'NotAnswerContactError',
'NotMessageOwnerError',
'NotQuestionOwnerError',
'QuestionTargetError',
]
import httplib
from lazr.restful.declarations import error_status
@error_status(httplib.BAD_REQUEST)
class AddAnswerContactError(ValueError):
"""The person cannot be an answer contact.
An answer contacts must be a valid user or team that has a preferred
language.
"""
@error_status(httplib.BAD_REQUEST)
class FAQTargetError(ValueError):
"""The target must be an `IFAQTarget`."""
@error_status(httplib.BAD_REQUEST)
class InvalidQuestionStateError(ValueError):
"""Error raised when the question is in an invalid state.
Error raised when a workflow action cannot be executed because the
question would be in an invalid state.
"""
@error_status(httplib.BAD_REQUEST)
class NotAnswerContactError(ValueError):
"""The person must be an answer contact."""
@error_status(httplib.BAD_REQUEST)
class NotMessageOwnerError(ValueError):
"""The person be the the message owner."""
@error_status(httplib.BAD_REQUEST)
class NotQuestionOwnerError(ValueError):
"""The person be the the question owner."""
@error_status(httplib.BAD_REQUEST)
class QuestionTargetError(ValueError):
"""The target must be an `IQueastionTarget`."""
|