Skip to content

Commit

Permalink
Update quart-trio and remove temporary shim code because quart-trio w…
Browse files Browse the repository at this point in the history
…as outdated
  • Loading branch information
CoolCat467 committed Oct 7, 2023
1 parent ce24f4b commit 9e806ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 37 deletions.
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "sanescansrv"
version = "2.1.3"
version = "2.1.4"
authors = [
{ name="CoolCat467" },
]
Expand All @@ -23,11 +23,11 @@ classifiers = [
]
keywords = ["scanner", "sane", "server", "frontend"]
dependencies = [
"hypercorn[trio]~=0.14.3",
"Pillow~=10.0.0",
"hypercorn[trio]~=0.14.4",
"Pillow~=10.0.1",
"python-sane~=2.9.1",
"quart~=0.19.2",
"quart-trio~=0.10.0",
"quart~=0.19.3",
"quart-trio~=0.11.0",
"trio~=0.22.0",
"Werkzeug~=3.0.0"
]
Expand Down
35 changes: 3 additions & 32 deletions src/sanescansrv/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

__title__ = "Sane Scanner Web Server"
__author__ = "CoolCat467"
__version__ = "2.1.3"
__version__ = "2.1.4"
__license__ = "GPLv3"


Expand All @@ -41,8 +41,7 @@
import trio
from hypercorn.config import Config
from hypercorn.trio import serve
from quart import Response, request, request_started
from quart.ctx import RequestContext
from quart import Response, request
from quart.templating import stream_template
from quart_trio import QuartTrio
from werkzeug import Response as WerkzeugResponse
Expand Down Expand Up @@ -130,35 +129,7 @@ def as_argument(self) -> str:
return f"--{self.name}={self.set if self.set is not None else self.default}"


class HopefullyTemporarySubclass(QuartTrio):
"""Hopefully Temporary Subclass of QuartTrio with patched code because QuartTrio is out of date."""

__slots__ = ()

async def full_dispatch_request(
self,
request_context: RequestContext | None = None,
) -> Response | WerkzeugResponse:
"""Adds pre and post processing to the request dispatching.
Arguments:
---------
request_context: The request context, optional as Flask
omits this argument.
"""
# await self.try_trigger_before_first_request_functions()
# await request_started.send(self)
await request_started.send_async(self, _sync_wrapper=self.ensure_async)
try:
result = await self.preprocess_request(request_context)
if result is None:
result = await self.dispatch_request(request_context)
except (Exception, trio.MultiError) as error:
result = await self.handle_user_exception(error) # type: ignore[assignment]
return await self.finalize_request(result, request_context) # type: ignore[arg-type]


app: Final = HopefullyTemporarySubclass( # pylint: disable=invalid-name
app: Final = QuartTrio( # pylint: disable=invalid-name
__name__,
static_folder="static",
template_folder="templates",
Expand Down

0 comments on commit 9e806ab

Please sign in to comment.