def raise_412(instance, msg=None):
    """Abort the current request with a 412 (Precondition Failed) response
    code. If the message is given it's output as an error message in the
    response body (correctly converted to the requested MIME type).

    :param instance: Resource instance (used to access the response)
    :type instance: :class:`webob.resource.Resource`
    :raises: :class:`webob.exceptions.ResponseException` of status 412
    """
    instance.response.status = 412
    if msg:
        instance.response.body_raw = {'error': msg}
    raise ResponseException(instance.response)
def raise_412 ( instance , msg = None ) : instance . response . status = 412 if msg : instance . response . body_raw = { 'error' : msg } raise ResponseException ( instance . response )
Abort the current request with a 412 (Precondition Failed) response
    code. If the message is given it's output as an error message in the
    response body (correctly converted to the requested MIME type).

    :param instance: Resource instance (used to access the response)
    :type instance: :class:`webob.resource.Resource`
    :raises: :class:`webob.exceptions.ResponseException` of status 412