POC for compatibility mode
This commit is contained in:
parent
a5d7d03413
commit
23c1eaab29
|
@ -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
|
||||
|
|
18
sanic/breaking/__init__.py
Normal file
18
sanic/breaking/__init__.py
Normal 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__}")
|
0
sanic/breaking/v22_12/__init__.py
Normal file
0
sanic/breaking/v22_12/__init__.py
Normal file
1123
sanic/breaking/v22_12/request.py
Normal file
1123
sanic/breaking/v22_12/request.py
Normal file
File diff suppressed because it is too large
Load Diff
0
sanic/breaking/v23_3/__init__.py
Normal file
0
sanic/breaking/v23_3/__init__.py
Normal file
9
sanic/breaking/v23_3/request.py
Normal file
9
sanic/breaking/v23_3/request.py
Normal 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
|
1130
sanic/request.py
1130
sanic/request.py
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user