A few more words about Bottle. After enabling a sqlite extension, you can easily include a specified keyword as a view argument. Like:
app = bottle.Bottle()
db_plugin = bottle_sqlite.Plugin(dbfile='./test.db', keyword="db")
app.install(db_plugin)
@app.route("/")
def main(db):
....
It works perfect... Until you decide to show the view for authorized users only. And this
@bottle.auth_basic()
def save_post(db):
...
will cause
TypeError("main() missing 1 required positional argument: 'db'")
This is a known issue, which still wasn't solved on the plugin level. So, again workarounds
The only change here is:
params = inspect.signature(_callback).parameters
if keyword not in params:
return callback
instead of
argspec = inspect.getargspec(_callback)
Top comments (0)