POC for compatibility mode

This commit is contained in:
Adam Hopkins 2023-03-09 09:54:32 +02:00
parent a5d7d03413
commit 23c1eaab29
No known key found for this signature in database
GPG Key ID: 9F85EE6C807303FB
8 changed files with 1167 additions and 1126 deletions

View File

@ -1 +1,10 @@
__version__ = "22.12.0" __version__ = "23.3.0"
__compatibility__ = "22.12"
from inspect import currentframe, stack
for frame_info in stack():
if frame_info.frame is not currentframe():
for member, value in frame_info.frame.f_globals.items():
if member.startswith("__") and member.isupper():
__compatibility__ = value

View File

@ -0,0 +1,18 @@
from sanic.__version__ import __compatibility__
if __compatibility__ == "22.12":
from .v22_12.request import (
File,
Request,
RequestParameters,
parse_multipart_form,
)
elif __compatibility__ == "23.3":
from .v23_3.request import (
File,
Request,
RequestParameters,
parse_multipart_form,
)
else:
raise RuntimeError(f"Unknown compatibility value: {__compatibility__}")

View File

File diff suppressed because it is too large Load Diff

View File

View File

@ -0,0 +1,9 @@
from ..v22_12.request import File
from ..v22_12.request import Request as LegacyRequest
from ..v22_12.request import RequestParameters, parse_multipart_form
class Request(LegacyRequest):
@property
def something_new(self):
return 123

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +1,4 @@
[flake8] [flake8]
ignore = E203, W503 ignore = E203, W503
per-file-ignores =
sanic/app.py:E402