tina4-python 0.2.24__tar.gz → 0.2.26__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tina4_python-0.2.24 → tina4_python-0.2.26}/PKG-INFO +1 -1
- {tina4_python-0.2.24 → tina4_python-0.2.26}/pyproject.toml +1 -1
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/.env +1 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/Debug.py +2 -1
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/Response.py +8 -9
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/Router.py +7 -2
- tina4_python-0.2.26/tina4_python/logs/debug.log +1066 -0
- tina4_python-0.2.26/tina4_python/test.db +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/README.md +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/Auth.py +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/Constant.py +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/Database.py +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/DatabaseResult.py +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/Env.py +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/Localization.py +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/Messages.py +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/MiddleWare.py +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/Migration.py +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/Request.py +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/Session.py +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/ShellColors.py +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/Swagger.py +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/Template.py +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/Webserver.py +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/__init__.py +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/messages.pot +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/public/css/readme.md +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/public/favicon.ico +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/public/images/403.png +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/public/images/404.png +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/public/images/logo.png +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/public/images/readme.md +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/public/js/readme.md +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/public/js/tina4helper.js +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/public/swagger/index.html +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/public/swagger/oauth2-redirect.html +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/secrets/domain.cert +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/secrets/private.key +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/secrets/public.key +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/templates/errors/403.twig +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/templates/errors/404.twig +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/templates/readme.md +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/translations/en/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/translations/en/LC_MESSAGES/messages.po +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/translations/fr/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-0.2.24 → tina4_python-0.2.26}/tina4_python/translations/fr/LC_MESSAGES/messages.po +0 -0
|
@@ -16,21 +16,19 @@ content = ""
|
|
|
16
16
|
http_code = Constant.HTTP_OK
|
|
17
17
|
content_type = Constant.TEXT_HTML
|
|
18
18
|
|
|
19
|
+
|
|
19
20
|
class Response:
|
|
20
21
|
def __init__(self, content_in=None, http_code_in=None, content_type_in=None,
|
|
21
|
-
|
|
22
|
+
headers_in=None):
|
|
22
23
|
global headers
|
|
23
24
|
global content
|
|
24
25
|
global http_code
|
|
25
26
|
global content_type
|
|
26
27
|
|
|
27
|
-
if content is not None:
|
|
28
|
-
content_in = content + content_in
|
|
29
|
-
|
|
30
28
|
if (not isinstance(content_in, bool) and not isinstance(content_in, object)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
and not isinstance(content_in, bytes)
|
|
30
|
+
and not isinstance(content_in, str)
|
|
31
|
+
and not isinstance(content_in, list) and inspect.isclass(type(content_in))):
|
|
34
32
|
content_in = dict(content_in)
|
|
35
33
|
|
|
36
34
|
# check if database result
|
|
@@ -53,6 +51,9 @@ class Response:
|
|
|
53
51
|
content_in = json.dumps({"error": "Cannot decode object of type " + str(type(content_in))})
|
|
54
52
|
content_type = Constant.APPLICATION_JSON
|
|
55
53
|
|
|
54
|
+
if content is not None and isinstance(content_in, str):
|
|
55
|
+
content_in = content + content_in
|
|
56
|
+
|
|
56
57
|
self.headers = headers_in if headers_in is not None else headers
|
|
57
58
|
self.content = content_in if content_in is not None else content
|
|
58
59
|
self.http_code = http_code_in if http_code_in is not None else http_code
|
|
@@ -90,5 +91,3 @@ class Response:
|
|
|
90
91
|
"""
|
|
91
92
|
global headers
|
|
92
93
|
headers[key] = value
|
|
93
|
-
|
|
94
|
-
|
|
@@ -66,6 +66,7 @@ class Router:
|
|
|
66
66
|
Response.headers = {}
|
|
67
67
|
Response.content = ""
|
|
68
68
|
Response.http_code = Constant.HTTP_OK
|
|
69
|
+
Response.content_type = Constant.TEXT_HTML
|
|
69
70
|
result = None
|
|
70
71
|
|
|
71
72
|
Debug("Root Path " + tina4_python.root_path + " " + url, method, Constant.TINA4_LOG_DEBUG)
|
|
@@ -121,6 +122,7 @@ class Router:
|
|
|
121
122
|
return Response.Response(file.read(), Constant.HTTP_OK, mime_type)
|
|
122
123
|
|
|
123
124
|
old_stdout = None
|
|
125
|
+
buffer = io.StringIO()
|
|
124
126
|
for route in tina4_python.tina4_routes.values():
|
|
125
127
|
if route["method"] != method:
|
|
126
128
|
continue
|
|
@@ -178,7 +180,6 @@ class Router:
|
|
|
178
180
|
if not route["cache"]["cached"]:
|
|
179
181
|
result.headers["Cache-Control"] = "max-age=1, must-revalidate"
|
|
180
182
|
result.headers["Pragma"] = "no-cache"
|
|
181
|
-
result.headers["Clear-Site-Data"] = "cache"
|
|
182
183
|
else:
|
|
183
184
|
result.headers["Cache-Control"] = "max-age=" + str(
|
|
184
185
|
route["cache"]["max_age"]) + ", must-revalidate"
|
|
@@ -190,7 +191,11 @@ class Router:
|
|
|
190
191
|
break
|
|
191
192
|
|
|
192
193
|
if result is None:
|
|
193
|
-
|
|
194
|
+
if old_stdout is not None:
|
|
195
|
+
sys.stdout = old_stdout
|
|
196
|
+
else:
|
|
197
|
+
sys.stdout = buffer = io.StringIO()
|
|
198
|
+
|
|
194
199
|
try:
|
|
195
200
|
return Response.Response(json.loads(buffer.getvalue()), Constant.HTTP_OK, Constant.APPLICATION_JSON)
|
|
196
201
|
except:
|