This commit is contained in:
dogeystamp 2023-04-30 17:33:43 -04:00
parent ec3245dd4f
commit e96e3a376b
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
5 changed files with 18 additions and 8 deletions

View File

@ -14,7 +14,9 @@ with app.app_context():
overlay_config(TestingConfig, "./config-testing.yml") overlay_config(TestingConfig, "./config-testing.yml")
elif app.config["DEBUG"]: elif app.config["DEBUG"]:
overlay_config(DevelopmentConfig) overlay_config(DevelopmentConfig)
app.logger.warning("Running in DEVELOPMENT MODE; do NOT use this in production!") app.logger.warning(
"Running in DEVELOPMENT MODE; do NOT use this in production!"
)
else: else:
overlay_config(ProductionConfig) overlay_config(ProductionConfig)

View File

@ -100,7 +100,9 @@ class User(db.Model):
"sub": self.username, "sub": self.username,
"jti": jti, "jti": jti,
} }
return jwt.encode(payload, current_app.config.get("SECRET_KEY"), algorithm="HS256") return jwt.encode(
payload, current_app.config.get("SECRET_KEY"), algorithm="HS256"
)
def read_token(token): def read_token(token):
"""Read a JWT and validate it. """Read a JWT and validate it.

View File

@ -270,10 +270,15 @@ class ModelListAPI(MethodView):
per_page = int(json_data.get("per_page", 15)) per_page = int(json_data.get("per_page", 15))
page = int(json_data.get("page", 1)) page = int(json_data.get("page", 1))
except ValueError as e: except ValueError as e:
return jsonify(dict( return (
status="fail", jsonify(
message=str(e), dict(
)), 400 status="fail",
message=str(e),
)
),
400,
)
page_data = ModelClass.query.paginate(page=page, per_page=per_page) page_data = ModelClass.query.paginate(page=page, per_page=per_page)
data = [model.get_schema().dump(model) for model in page_data] data = [model.get_schema().dump(model) for model in page_data]

View File

@ -18,7 +18,9 @@ class FileSystem(Storage):
self._files_directory.mkdir(mode=0o700, exist_ok=True, parents=True) self._files_directory.mkdir(mode=0o700, exist_ok=True, parents=True)
if not self._directory.is_dir(): if not self._directory.is_dir():
raise OSError(f"'{current_app.config['SACHET_FILE_DIR']}' is not a directory.") raise OSError(
f"'{current_app.config['SACHET_FILE_DIR']}' is not a directory."
)
def _get_path(self, name): def _get_path(self, name):
name = secure_filename(name) name = secure_filename(name)

View File

@ -253,7 +253,6 @@ class TestSuite:
) )
assert resp.status_code == 423 assert resp.status_code == 423
# unlock share # unlock share
resp = client.post( resp = client.post(
url + "/unlock", url + "/unlock",