tg123/bottle-mysql

With nested decorators and plugins gives errors during requests

Opened this issue · 0 comments

If I leave something like

    @app.route(APPROOT + '/new', method=['GET', 'POST'])
    @valid_user()
    def new(db):

I get this
TypeError: new() takes exactly 1 argument (0 given)

If I do db=None


    @app.route(APPROOT + '/new', method=['GET', 'POST'])
    @valid_user()
    def new(db=None):

I get

AttributeError: 'NoneType' object has no attribute 'execute'

Seems like the bottlesession decorator is in the way. And it's not just bottlesession

You can check with basic auth decorators as well, I had to functionally rewrite basic auth because plugin retrospection gives Nonetype object bug as well. For example this one https://gist.github.com/thinkxl/8296214
or this one
https://stackoverflow.com/questions/13272528/bottle-py-http-auth