Example #1
0
def explode_no_auth(real_user, user, type=None, **kw):
    """
    An action to test the error handling of the stack. The tests use this.
    """
    if type == 'app':
        raise AppException('This is an app exception!', code=INVALID, field='type')
    elif type == 'client':
        raise ClientException('Oh Noes, ClientException!', code=INVALID, field='type')
    elif type == 'client404':
        raise ClientException('Oh Noes, ClientException NOT FOUND!', code=NOT_FOUND, field='type')
    elif type == 'client403':
        raise ClientException('Oh Noes, ClientException FORBIDDEN!', code=FORBIDDEN, field='type')
    elif type == 'explosion':
        1/0
    elif type == 'http':
        abort(404, 'This thing was not found!')
    elif type == 'validation':
        class Rawr(formencode.Schema):
            meow = fv.Number()
        scrubbed = validate(Rawr, meow='zzzz')
    
    return kw
Example #2
0
def get(real_user, user, id):
    if not id:
        abort(403)
    return id