Clean up and refactoring of code and style
I didn't do much to the functionality of the code, however I did make style changes that I believe will make the project more readable.develop
parent
c7d65e06d2
commit
49b0844d81
@ -1,2 +1,3 @@
|
||||
include wsgi
|
||||
recursive-include cookie_api/templates *
|
||||
recursive-include cookie_api/static *
|
@ -1,28 +0,0 @@
|
||||
import sys
|
||||
|
||||
from apistar import App, exceptions
|
||||
from apistar.http import Response, HTMLResponse
|
||||
from apistar.server.components import ReturnValue
|
||||
from .http import MetaJSONResponse
|
||||
|
||||
|
||||
class MetaApp(App):
|
||||
"""
|
||||
A WSGI App subclass with a MetaJSONResponse default response type
|
||||
"""
|
||||
|
||||
def render_response(self, return_value: ReturnValue) -> Response:
|
||||
if isinstance(return_value, Response):
|
||||
return return_value
|
||||
elif isinstance(return_value, str):
|
||||
return HTMLResponse(return_value)
|
||||
return MetaJSONResponse(return_value)
|
||||
|
||||
def exception_handler(self, exc: Exception) -> Response:
|
||||
if isinstance(exc, exceptions.HTTPException):
|
||||
|
||||
return MetaJSONResponse(exc.detail, status_code=exc.status_code, headers=exc.get_headers())
|
||||
raise
|
||||
|
||||
def error_handler(self) -> Response:
|
||||
return MetaJSONResponse('Server error', status_code=500, exc_info=sys.exc_info())
|
@ -0,0 +1,8 @@
|
||||
apistar
|
||||
apistar-jwt
|
||||
apistar-mail
|
||||
bcrypt
|
||||
psycopg2-binary
|
||||
itsdangerous
|
||||
logbook
|
||||
sqlalchemy
|
Loading…
Reference in New Issue