New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
validate() decorator cannot work with sqlite.plugin #248
Comments
Add validate decorator to apply parameter.
|
this works, but can anyone explain why this works while the decorator style doesn't? |
The decorator style wraps the callback with another function with different arguments. The http://docs.python.org/library/functools.html#functools.update_wrapper |
is it possible to add @wraps decorator inside the validate decorator in bottle.py to fix it? |
I never did it, but it is what bottle do. Probably it works. |
Should work now. |
the @Validate decorator will not work if used together with sqlite plugin since it requires the use of non-keyword argument
using the web todo list tutorial from official website as example
...
@route('/edit/:no', method='GET', apply=sqlite.Plugin(dbfile='todo.db'))
@Validate(no=int)
def edit_item(db, no):
...
calling the url @ /edit/2 will return http error 500
TypeError('edit_item() takes exactly 2 non-keyword arguments (0 given)',)
The text was updated successfully, but these errors were encountered: