Fix: Working outside of request context
RuntimeError: Working outside of application context.
This typically means that you attempted to use functionality that needed to interface with the current application object in some way. To solve this, set up an application context with app.app_context().
https://github.com/python-restx/flask-restx/blob/master/flask_restx/marshalling.py#L251 --> this line is protected by has_app_context
https://github.com/python-restx/flask-restx/blob/master/flask_restx/marshalling.py#L252 --> this line is not protected by has_request_context
I have integrated marshal_with serializer to database SQLAlchemy models But getting the RuntimeError: Working outside of request context
Corrected the code and successfully ran tox tests.
Codecov Report
Merging #360 (d5ac614) into master (88497ce) will decrease coverage by
0.00%. The diff coverage is100.00%.
:exclamation: Current head d5ac614 differs from pull request most recent head eb274dd. Consider uploading reports for the commit eb274dd to get more accurate results
@@ Coverage Diff @@
## master #360 +/- ##
==========================================
- Coverage 96.86% 96.86% -0.01%
==========================================
Files 20 20
Lines 2741 2740 -1
==========================================
- Hits 2655 2654 -1
Misses 86 86
| Impacted Files | Coverage Δ | |
|---|---|---|
| flask_restx/marshalling.py | 98.21% <100.00%> (ø) |
|
| flask_restx/api.py | 96.75% <0.00%> (-0.01%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 88497ce...eb274dd. Read the comment docs.
LGTM. Can you think of any cases where this could cause a problem? I can't think of any.
Hi @j5awry, Any update on this?