Compare commits

...

2 Commits

Author SHA1 Message Date
Adam Hopkins
c695c5250a
squash 2023-03-09 10:37:41 +02:00
Adam Hopkins
23c1eaab29
POC for compatibility mode 2023-03-09 09:54:32 +02:00
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():
value = frame_info.frame.f_globals.get("__SANIC_COMPATIBILITY__")
if value:
__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