'UpdatePreviewDiffNotReady', 'UpgradePending', 'UserHasExistingReview', 'UserNotBranchReviewer', 'WrongBranchMergeProposal', ] import httplib from bzrlib.plugins.builder.recipe import RecipeParseError from lazr.restful.declarations import error_status from lp.app.errors import NameLookupFailed # Annotate the RecipeParseError's with a 400 webservice status. error_status(httplib.BAD_REQUEST)(RecipeParseError) class BadBranchMergeProposalSearchContext(Exception): """The context is not valid for a branch merge proposal search.""" @error_status(httplib.BAD_REQUEST) class BadStateTransition(Exception): """The user requested a state transition that is not possible.""" class BranchCreationException(Exception): """Base class for branch creation exceptions."""
class UnexpectedFormData(AssertionError): """Got form data that is not what is expected by a form handler.""" class POSTToNonCanonicalURL(UnexpectedFormData): """Got a POST to an incorrect URL. One example would be a URL containing uppercase letters. """ @error_status(httplib.UNAUTHORIZED) class UserCannotUnsubscribePerson(Unauthorized): """User does not have permission to unsubscribe person or team.""" @error_status(httplib.BAD_REQUEST) class SubscriptionPrivacyViolation(Exception): """The subscription would violate privacy policies.""" @error_status(httplib.BAD_REQUEST) class ServiceUsageForbidden(Exception): """The specified ServiceUsage is not allowed.""" # Slam a 401 response code onto all ForbiddenAttribute errors. error_status(httplib.UNAUTHORIZED)(ForbiddenAttribute)
from lp.services.webapp.interfaces import ( ICanonicalUrlData, ILaunchBag, ILaunchpadApplication, ILaunchpadContainer, ILaunchpadRoot, IOpenLaunchBag, IStructuredString, NoCanonicalUrl, ) from lp.services.webapp.url import urlappend from lp.services.webapp.vhosts import allvhosts # Monkeypatch NotFound to always avoid generating OOPS # from NotFound in web service calls. error_status(httplib.NOT_FOUND)(NotFound) # Used to match zope namespaces eg ++model++. RESERVED_NAMESPACE = re.compile('\\+\\+.*\\+\\+') class DecoratorAdvisor: """Base class for a function decorator that adds class advice. The advice stores information in a magic attribute in the class's dict. The magic attribute's value is a dict, which contains names and functions that were set in the function decorators. """ magic_class_attribute = None
'UserNotBranchReviewer', 'WrongBranchMergeProposal', ] import httplib from bzrlib.plugins.builder.recipe import RecipeParseError from lazr.restful.declarations import error_status from lp.app.errors import ( NameLookupFailed, NotFoundError, ) # Annotate the RecipeParseError's with a 400 webservice status. error_status(httplib.BAD_REQUEST)(RecipeParseError) class BadBranchMergeProposalSearchContext(Exception): """The context is not valid for a branch merge proposal search.""" @error_status(httplib.BAD_REQUEST) class BadStateTransition(Exception): """The user requested a state transition that is not possible.""" class BranchCreationException(Exception): """Base class for branch creation exceptions."""