Compare commits

..

No commits in common. "1.12.1-fixed3" and "main" have entirely different histories.

6 changed files with 5 additions and 26 deletions

View File

@ -1,11 +0,0 @@
stages:
- package
publish-pypi:
stage: package
image: python:3.8
script:
- pip install -U setuptools wheel pip; pip install invoke
- invoke upload --pypi-user ${PYPI_REPO_USER} --pypi-password ${PYPI_REPO_PASSWORD} --pypi-url ${PYPI_REPO_URL}
only:
- tags

View File

@ -1,5 +1,5 @@
from .view import PydanticView from .view import PydanticView
__version__ = "1.12.1-fixed3" __version__ = "1.12.1"
__all__ = ("PydanticView", "__version__") __all__ = ("PydanticView", "__version__")

View File

@ -15,13 +15,10 @@ def setup(
enable: bool = True, enable: bool = True,
version_spec: Optional[str] = None, version_spec: Optional[str] = None,
title_spec: Optional[str] = None, title_spec: Optional[str] = None,
raise_validation_errors: bool = False,
): ):
if enable: if enable:
oas_app = web.Application() oas_app = web.Application()
oas_app["apps to expose"] = tuple(apps_to_expose) or (app,) oas_app["apps to expose"] = tuple(apps_to_expose) or (app,)
for a in oas_app["apps to expose"]:
a['raise_validation_errors'] = raise_validation_errors
oas_app["index template"] = jinja2.Template( oas_app["index template"] = jinja2.Template(
resources.read_text("aiohttp_pydantic.oas", "index.j2") resources.read_text("aiohttp_pydantic.oas", "index.j2")
) )

View File

@ -185,8 +185,6 @@ async def oas_ui(request):
static_url = request.app.router["static"].url_for(filename="") static_url = request.app.router["static"].url_for(filename="")
spec_url = request.app.router["spec"].url_for() spec_url = request.app.router["spec"].url_for()
if request.scheme != request.headers.get('x-forwarded-proto', request.scheme):
request = request.clone(scheme=request.headers['x-forwarded-proto'])
host = request.url.origin() host = request.url.origin()
return Response( return Response(

View File

@ -127,10 +127,7 @@ def inject_params(
else: else:
injector.inject(self.request, args, kwargs) injector.inject(self.request, args, kwargs)
except ValidationError as error: except ValidationError as error:
if self.request.app['raise_validation_errors']: return await self.on_validation_error(error, injector.context)
raise
else:
return await self.on_validation_error(error, injector.context)
return await handler(self, *args, **kwargs) return await handler(self, *args, **kwargs)

View File

@ -136,7 +136,6 @@ def prepare_ci_env(c):
title("Installing wheel", "=") title("Installing wheel", "=")
package_version = read_configuration("./setup.cfg")["metadata"]["version"] package_version = read_configuration("./setup.cfg")["metadata"]["version"]
print([x for x in Path("dist").glob('*')])
dist = next(Path("dist").glob(f"aiohttp_pydantic-{package_version}-*.whl")) dist = next(Path("dist").glob(f"aiohttp_pydantic-{package_version}-*.whl"))
c.run(f"dist_venv/bin/python -m pip install {dist}") c.run(f"dist_venv/bin/python -m pip install {dist}")
@ -157,7 +156,7 @@ def prepare_upload(c):
@task(tag_eq_version, prepare_upload) @task(tag_eq_version, prepare_upload)
def upload(c, pypi_user=None, pypi_password=None, pypi_url=None): def upload(c, pypi_user=None, pypi_password=None):
""" """
Upload on pypi Upload on pypi
""" """
@ -166,9 +165,8 @@ def upload(c, pypi_user=None, pypi_password=None, pypi_url=None):
if pypi_user is not None and pypi_password is not None: if pypi_user is not None and pypi_password is not None:
c.run( c.run(
f"dist_venv/bin/twine upload --non-interactive" f"dist_venv/bin/twine upload --non-interactive"
f" -u {pypi_user} -p {pypi_password} {dist}" f" -u {pypi_user} -p {pypi_password} {dist}",
f" --repository-url {pypi_url}",
hide=True, hide=True,
) )
else: else:
c.run(f"dist_venv/bin/twine upload --repository-url {pypi_url} --repository aiohttp-pydantic {dist}") c.run(f"dist_venv/bin/twine upload --repository aiohttp-pydantic {dist}")