https://github.com/socratescli/blueprint-decr
Add decorator for every view functions for a flask blueprint.
https://github.com/socratescli/blueprint-decr
Last synced: 3 days ago
JSON representation
Add decorator for every view functions for a flask blueprint.
- Host: GitHub
- URL: https://github.com/socratescli/blueprint-decr
- Owner: socratescli
- License: mit
- Created: 2016-12-01T17:09:39.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-01T17:21:39.000Z (over 9 years ago)
- Last Synced: 2026-03-08T21:41:51.761Z (4 months ago)
- Language: Python
- Size: 2.93 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# blueprint-decr
A tiny python lib for decorating all view functions of a flask blueprint.
## install
```
pip install blueprint-decr
```
## usage
```
# api_blueprint is a blueprint object
import functools
def dummy_decr(func):
@functools.wraps(func)
def wrapper(*sub, **kw):
print(func.__name__)
return func(*sub, **kw)
return wrapper
import blueprint_decr
new_api_blueprint = blueprint_decr.attach(api_blueprint, dummy_decr)
# now, you may register new_api_blueprint with flask app object.
# app.register_blueprint(new_api_blueprint, url_prefix='/api')
```