Skip to content

Commit

Permalink
Merge pull request #63 from mekanix/feature/decorators
Browse files Browse the repository at this point in the history
Fix decorators and development environment
  • Loading branch information
mekanix authored Jun 6, 2020
2 parents faa71e6 + 3ab1a6b commit 451a274
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.include <name.py>

SERVICE != echo ${app_name}back
SERVICE != echo ${app_name}
REGGAE_PATH := /usr/local/share/reggae

.include <${REGGAE_PATH}/mk/service.mk>
Expand Down
2 changes: 1 addition & 1 deletion bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ if [ "${OFFLINE}" != "yes" ]; then
fi

cd ${PROJECT_ROOT}
rm -rf freenit.egg-info build dist
rm -rf *.egg-info build dist
python setup.py sdist bdist_wheel
2 changes: 1 addition & 1 deletion bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
export BIN_DIR=`dirname $0`
export PROJECT_ROOT="${BIN_DIR}/.."
. "${PROJECT_ROOT}/name.py"
export VIRTUALENV=${VIRTUALENV:="${app_name}back"}
export VIRTUALENV=${VIRTUALENV:="${app_name}"}
export FLASK_ENV=${FLASK_ENV:="production"}
export PY_VERSION=${PY_VERSION:="3.7"}
export SYSPKG=${SYSPKG:="no"}
Expand Down
6 changes: 2 additions & 4 deletions bin/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -e

export BIN_DIR=`dirname $0`
export PROJECT_ROOT="${BIN_DIR}/.."
. "${PROJECT_ROOT}/name.py"
export FLASK_ENV="testing"
export DBTYPE="all"

Expand All @@ -29,7 +30,4 @@ rm -rf .pytest_cache
flake8 .

export DBTYPE="sql"
py.test --ignore=freenit/project/ --cov=freenit --cov-report=term-missing:skip-covered --cov-report=xml

# export DBTYPE="mongo"
# py.test --ignore=freenit/project/ --cov=freenit --cov-report=term-missing:skip-covered --cov-report=xml
py.test --ignore=${app_name}/project/ --cov=${app_name} --cov-report=term-missing:skip-covered --cov-report=xml
4 changes: 2 additions & 2 deletions freenit/api/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def post(self, args, role_id):
except User.DoesNotExist:
abort(404, message='No such user')
current_app.user_datastore.add_role_to_user(user, role)
return user
return role


@blueprint.route('/<role_id>/user/<user_id>', endpoint='user_deassign')
Expand All @@ -123,4 +123,4 @@ def delete(self, role_id, user_id):
except User.DoesNotExist:
abort(404, message='No such user')
current_app.user_datastore.remove_role_from_user(user, role)
return user
return role
3 changes: 1 addition & 2 deletions freenit/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

from flask import current_app
from flask_jwt_extended import get_jwt_identity

from flask_rest_api import abort
from flask_smorest import abort


def get_user():
Expand Down
3 changes: 0 additions & 3 deletions wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@
app = create_app(config)
hostname = socket.gethostname()
port = os.environ.get('FLASK_PORT', 5000)
REDOC_PATH = f'{config.OPENAPI_URL_PREFIX}{config.OPENAPI_REDOC_PATH}'
REDOC_URL = f'http://{hostname}:{port}{REDOC_PATH}'
SWAGGER_PATH = f'{config.OPENAPI_URL_PREFIX}{config.OPENAPI_SWAGGER_UI_PATH}'
SWAGGER_URL = f'http://{hostname}:{port}{SWAGGER_PATH}'

if __name__ == '__main__':
print(' * ReDoc URL:', REDOC_URL)
print(' * Swagger URL:', SWAGGER_URL)
app.run(
host='0.0.0.0',
Expand Down

0 comments on commit 451a274

Please sign in to comment.