tina4-python 0.2.16__tar.gz → 0.2.18__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.
Files changed (39) hide show
  1. {tina4_python-0.2.16 → tina4_python-0.2.18}/PKG-INFO +1 -1
  2. {tina4_python-0.2.16 → tina4_python-0.2.18}/pyproject.toml +1 -1
  3. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Request.py +4 -2
  4. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Router.py +3 -0
  5. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Webserver.py +13 -10
  6. {tina4_python-0.2.16 → tina4_python-0.2.18}/README.md +0 -0
  7. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Auth.py +0 -0
  8. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Constant.py +0 -0
  9. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Database.py +0 -0
  10. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/DatabaseResult.py +0 -0
  11. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Debug.py +0 -0
  12. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Env.py +0 -0
  13. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Localization.py +0 -0
  14. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Messages.py +0 -0
  15. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Migration.py +0 -0
  16. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Response.py +0 -0
  17. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Session.py +0 -0
  18. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/ShellColors.py +0 -0
  19. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Swagger.py +0 -0
  20. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/Template.py +0 -0
  21. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/__init__.py +0 -0
  22. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/messages.pot +0 -0
  23. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/css/readme.md +0 -0
  24. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/favicon.ico +0 -0
  25. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/images/403.png +0 -0
  26. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/images/404.png +0 -0
  27. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/images/logo.png +0 -0
  28. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/images/readme.md +0 -0
  29. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/js/readme.md +0 -0
  30. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/js/tina4helper.js +0 -0
  31. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/swagger/index.html +0 -0
  32. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/public/swagger/oauth2-redirect.html +0 -0
  33. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/templates/errors/403.twig +0 -0
  34. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/templates/errors/404.twig +0 -0
  35. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/templates/readme.md +0 -0
  36. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/translations/en/LC_MESSAGES/messages.mo +0 -0
  37. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/translations/en/LC_MESSAGES/messages.po +0 -0
  38. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/translations/fr/LC_MESSAGES/messages.mo +0 -0
  39. {tina4_python-0.2.16 → tina4_python-0.2.18}/tina4_python/translations/fr/LC_MESSAGES/messages.po +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tina4-python
3
- Version: 0.2.16
3
+ Version: 0.2.18
4
4
  Summary: Tina4Python - This is not another framework for Python
5
5
  Author: Andre van Zuydam
6
6
  Author-email: andrevanzuydam@gmail.com
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "tina4-python"
3
- version = "0.2.16"
3
+ version = "0.2.18"
4
4
  description = "Tina4Python - This is not another framework for Python"
5
5
  authors = ["Andre van Zuydam <andrevanzuydam@gmail.com>"]
6
6
  readme = "README.md"
@@ -9,7 +9,7 @@ class Request:
9
9
  Request object to store parameters, headers, etc.
10
10
  """
11
11
 
12
- def __init__(self, body=None, params=None, headers=None, request=None, raw=None):
12
+ def __init__(self, body=None, params=None, headers=None, request=None, raw_data=None, raw_request=None, raw_content=None):
13
13
  self.body = body if body is not None else None
14
14
  self.params = params if params is not None else {}
15
15
  self.headers = headers if headers is not None else {}
@@ -18,5 +18,7 @@ class Request:
18
18
  self.cookies = {}
19
19
  self.session = None
20
20
  self.files = {}
21
- self.raw = raw if raw is not None else None
21
+ self.raw_data = raw_data if raw_data is not None else None
22
+ self.raw_request = raw_request if raw_request is not None else None
23
+ self.raw_content = raw_content if raw_content is not None else None
22
24
 
@@ -132,6 +132,9 @@ class Router:
132
132
  Request.params = request["params"]
133
133
  Request.body = request["body"] if "body" in request else None
134
134
  Request.session = session
135
+ Request.raw_data = request["raw_data"] if "raw_data" in request else None
136
+ Request.raw_request = request["raw_request"] if "raw_request" in request else None
137
+ Request.raw_content = request["raw_content"] if "raw_content" in request else None
135
138
 
136
139
  tina4_python.tina4_current_request = Request
137
140
  old_stdout = sys.stdout # Memorize the default stdout stream
@@ -27,7 +27,7 @@ class Webserver:
27
27
 
28
28
  async def get_content_body(self, content_length):
29
29
  # get lines of content where at the end of the request
30
- content = self.request_raw
30
+ content = self.content_raw
31
31
 
32
32
  if "content-type" in self.lowercase_headers:
33
33
  if self.lowercase_headers["content-type"] == "application/x-www-form-urlencoded":
@@ -111,7 +111,7 @@ class Webserver:
111
111
  else:
112
112
  body = None
113
113
 
114
- request = {"params": params, "body": body, "raw": self.request, "headers": self.lowercase_headers}
114
+ request = {"params": params, "body": body, "raw_data": self.request, "headers": self.lowercase_headers, "raw_request": self.request_raw, "raw_content": self.content_raw}
115
115
 
116
116
  tina4_python.tina4_current_request = request
117
117
 
@@ -185,29 +185,31 @@ class Webserver:
185
185
  content_length = int(lowercase_headers["content-length"])
186
186
  count = 0
187
187
  read_size = 64
188
- raw_data = b''
189
- while len(raw_data) < content_length:
188
+ content_data = b''
189
+ while len(content_data) < content_length:
190
190
  read = await reader.read(read_size)
191
191
  count += len(read)
192
+ content_data += read
192
193
  raw_data += read
193
194
  # print('COUNT', count, len(read))
194
- if len(read) < read_size and len(raw_data) == content_length:
195
+ if len(read) < read_size and len(content_data) == content_length:
195
196
  break
196
197
  try:
197
- content = raw_data.decode("utf-8")
198
+ content = content_data.decode("utf-8")
198
199
  except: # probably binary or multipart form?
199
- content = raw_data
200
+ content = content_data
200
201
 
201
- return protocol, headers, lowercase_headers, content, raw_data
202
+ return protocol, headers, lowercase_headers, content, raw_data, content_data
202
203
 
203
204
  async def handle_client(self, reader, writer):
204
205
  # Get the client request
205
- protocol, headers_list, lowercase_headers, request, raw_data = await self.get_data(reader)
206
+ protocol, headers_list, lowercase_headers, request, request_raw, content_raw = await self.get_data(reader)
206
207
  # Strange blank request ?
207
208
  if protocol == '':
208
209
  return
209
210
  # Decode the request
210
- self.request_raw = raw_data
211
+ self.request_raw = request_raw
212
+ self.content_raw = content_raw
211
213
  self.request = request
212
214
  self.headers = headers_list
213
215
  self.lowercase_headers = lowercase_headers
@@ -249,6 +251,7 @@ class Webserver:
249
251
  writer.close()
250
252
 
251
253
  def __init__(self, host_name, port):
254
+ self.content_raw = None
252
255
  self.session = Session
253
256
  self.cookies = {}
254
257
  self.method = None
File without changes