~launchpad-pqm/launchpad/devel

14291.1.2 by Jeroen Vermeulen
Lint.
1
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
12221.9.38 by Tim Penhey
Fix the field validation code for DuplicateBug to use the right error.
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
4
"""Errors used in the lp/bugs modules."""
5
6
__metaclass__ = type
7
__all__ = [
14376.1.1 by Ian Booth
Do not allow multi-pillar bugs to become private
8
    'BugCannotBePrivate',
12221.9.38 by Tim Penhey
Fix the field validation code for DuplicateBug to use the right error.
9
    'InvalidBugTargetType',
10
    'InvalidDuplicateValue',
14188.2.6 by j.c.sackett
Made changes per lifeless's review.
11
    'SubscriptionPrivacyViolation',
12221.9.38 by Tim Penhey
Fix the field validation code for DuplicateBug to use the right error.
12
]
13
13228.3.9 by Francis J. Lacoste
Convert all webservice_error into error_status and use httplib constants.
14
import httplib
15
16
from lazr.restful.declarations import error_status
12221.9.38 by Tim Penhey
Fix the field validation code for DuplicateBug to use the right error.
17
12442.2.2 by j.c.sackett
Moved validators to app, which makes more sense.
18
from lp.app.validators import LaunchpadValidationError
12221.9.39 by Tim Penhey
Hook up the moved bug errors.
19
12221.9.38 by Tim Penhey
Fix the field validation code for DuplicateBug to use the right error.
20
13228.3.9 by Francis J. Lacoste
Convert all webservice_error into error_status and use httplib constants.
21
@error_status(httplib.BAD_REQUEST)
12221.9.38 by Tim Penhey
Fix the field validation code for DuplicateBug to use the right error.
22
class InvalidBugTargetType(Exception):
23
    """Bug target's type is not valid."""
13228.3.9 by Francis J. Lacoste
Convert all webservice_error into error_status and use httplib constants.
24
25
26
@error_status(httplib.EXPECTATION_FAILED)
12221.9.39 by Tim Penhey
Hook up the moved bug errors.
27
class InvalidDuplicateValue(LaunchpadValidationError):
12221.9.38 by Tim Penhey
Fix the field validation code for DuplicateBug to use the right error.
28
    """A bug cannot be set as the duplicate of another."""
14188.2.6 by j.c.sackett
Made changes per lifeless's review.
29
14291.1.2 by Jeroen Vermeulen
Lint.
30
14188.2.6 by j.c.sackett
Made changes per lifeless's review.
31
@error_status(httplib.BAD_REQUEST)
32
class SubscriptionPrivacyViolation(Exception):
33
    """The subscription would violate privacy policies."""
14376.1.1 by Ian Booth
Do not allow multi-pillar bugs to become private
34
35
36
@error_status(httplib.BAD_REQUEST)
37
class BugCannotBePrivate(Exception):
38
    """The bug is not allowed to be private."""