mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Removed Sanic HTTPMethodView
This commit is contained in:
parent
79950c9643
commit
1e0998ed2d
1 changed files with 5 additions and 2 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
import json
|
import json
|
||||||
from mimetypes import guess_type
|
from mimetypes import guess_type
|
||||||
from sanic.views import HTTPMethodView
|
|
||||||
from sanic.request import Request as SanicRequest
|
from sanic.request import Request as SanicRequest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from html import escape
|
from html import escape
|
||||||
|
|
@ -82,7 +81,11 @@ class AsgiLifespan:
|
||||||
await self.app(scope, receive, send)
|
await self.app(scope, receive, send)
|
||||||
|
|
||||||
|
|
||||||
class AsgiView(HTTPMethodView):
|
class AsgiView:
|
||||||
|
def dispatch_request(self, request, *args, **kwargs):
|
||||||
|
handler = getattr(self, request.method.lower(), None)
|
||||||
|
return handler(request, *args, **kwargs)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def as_asgi(cls, *class_args, **class_kwargs):
|
def as_asgi(cls, *class_args, **class_kwargs):
|
||||||
async def view(scope, receive, send):
|
async def view(scope, receive, send):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue