~launchpad-pqm/launchpad/devel

12221.9.38 by Tim Penhey
Fix the field validation code for DuplicateBug to use the right error.
1
# Copyright 2009 Canonical Ltd.  This software is licensed under the
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__ = [
8
    'InvalidBugTargetType',
9
    'InvalidDuplicateValue',
14188.2.6 by j.c.sackett
Made changes per lifeless's review.
10
    'SubscriptionPrivacyViolation',
12221.9.38 by Tim Penhey
Fix the field validation code for DuplicateBug to use the right error.
11
]
12
13228.3.9 by Francis J. Lacoste
Convert all webservice_error into error_status and use httplib constants.
13
import httplib
14
15
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.
16
12442.2.2 by j.c.sackett
Moved validators to app, which makes more sense.
17
from lp.app.validators import LaunchpadValidationError
12221.9.39 by Tim Penhey
Hook up the moved bug errors.
18
12221.9.38 by Tim Penhey
Fix the field validation code for DuplicateBug to use the right error.
19
13228.3.9 by Francis J. Lacoste
Convert all webservice_error into error_status and use httplib constants.
20
@error_status(httplib.BAD_REQUEST)
12221.9.38 by Tim Penhey
Fix the field validation code for DuplicateBug to use the right error.
21
class InvalidBugTargetType(Exception):
22
    """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.
23
24
25
@error_status(httplib.EXPECTATION_FAILED)
12221.9.39 by Tim Penhey
Hook up the moved bug errors.
26
class InvalidDuplicateValue(LaunchpadValidationError):
12221.9.38 by Tim Penhey
Fix the field validation code for DuplicateBug to use the right error.
27
    """A bug cannot be set as the duplicate of another."""
14188.2.6 by j.c.sackett
Made changes per lifeless's review.
28
29
@error_status(httplib.BAD_REQUEST)
30
class SubscriptionPrivacyViolation(Exception):
31
    """The subscription would violate privacy policies."""