1
0
mirror of https://github.com/pypiserver/pypiserver synced 2024-12-20 13:55:49 +01:00

Fix usage of string formatting in HTTPError (#310)

`HTTPError(code, message, format_args)` appears to be equivalent to `HTTPError(status=code, body=message, exception=format_args)` which is not what we want here. The string formatting can't be deferred like in logging library usage.
This commit is contained in:
Micah Smith 2020-06-04 20:28:38 -04:00 committed by GitHub
parent 6589170cfb
commit 1efb991069
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -174,9 +174,7 @@ def file_upload():
):
raise HTTPError(
400,
"Unrelated signature %r for package %r!",
ufiles.sig,
ufiles.pkg,
"Unrelated signature %r for package %r!" % (ufiles.sig, ufiles.pkg)
)
for uf in ufiles:
@ -197,8 +195,8 @@ def file_upload():
raise HTTPError(
409,
"Package %r already exists!\n"
" You may start server with `--overwrite` option.",
uf.raw_filename,
" You may start server with `--overwrite` option."
% uf.raw_filename,
)
core.store(packages.root, uf.raw_filename, uf.save)