From 1e0998ed2dc80d77b3d191ec09318f0f6fea5aff Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Sun, 23 Jun 2019 15:13:25 -0700 Subject: [PATCH] Removed Sanic HTTPMethodView --- datasette/utils/asgi.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/datasette/utils/asgi.py b/datasette/utils/asgi.py index ac7d62a4..1cbdd583 100644 --- a/datasette/utils/asgi.py +++ b/datasette/utils/asgi.py @@ -1,6 +1,5 @@ import json from mimetypes import guess_type -from sanic.views import HTTPMethodView from sanic.request import Request as SanicRequest from pathlib import Path from html import escape @@ -82,7 +81,11 @@ class AsgiLifespan: 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 def as_asgi(cls, *class_args, **class_kwargs): async def view(scope, receive, send):