Skip to content

Commit c9547d1

Browse files
committed
Tweak quart for python 3.7 to 3.11
1 parent 0c12ed5 commit c9547d1

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

graphql_server/quart/graphqlview.py

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import copy
2-
import sys
32
from collections.abc import MutableMapping
43
from functools import partial
54
from typing import List
@@ -191,20 +190,8 @@ def should_display_graphiql(self):
191190
def request_wants_html():
192191
best = request.accept_mimetypes.best_match(["application/json", "text/html"])
193192

194-
# Needed as this was introduced at Quart 0.8.0: https://gitlab.com/pgjones/quart/-/issues/189
195-
def _quality(accept, key: str) -> float:
196-
for option in accept.options:
197-
if accept._values_match(key, option.value):
198-
return option.quality
199-
return 0.0
200-
201-
if sys.version_info >= (3, 7):
202-
return (
203-
best == "text/html"
204-
and request.accept_mimetypes[best]
205-
> request.accept_mimetypes["application/json"]
206-
)
207-
else:
208-
return best == "text/html" and _quality(
209-
request.accept_mimetypes, best
210-
) > _quality(request.accept_mimetypes, "application/json")
193+
return (
194+
best == "text/html"
195+
and request.accept_mimetypes[best]
196+
> request.accept_mimetypes["application/json"]
197+
)

0 commit comments

Comments
 (0)