tina4-python 0.2.150__tar.gz → 0.2.152__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 (56) hide show
  1. {tina4_python-0.2.150 → tina4_python-0.2.152}/PKG-INFO +1 -1
  2. {tina4_python-0.2.150 → tina4_python-0.2.152}/pyproject.toml +1 -1
  3. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Template.py +5 -6
  4. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/__init__.py +6 -6
  5. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/cli.py +5 -5
  6. {tina4_python-0.2.150 → tina4_python-0.2.152}/.gitignore +0 -0
  7. {tina4_python-0.2.150 → tina4_python-0.2.152}/README.md +0 -0
  8. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Api.py +0 -0
  9. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Auth.py +0 -0
  10. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/CRUD.py +0 -0
  11. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Constant.py +0 -0
  12. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Database.py +0 -0
  13. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/DatabaseResult.py +0 -0
  14. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/DatabaseTypes.py +0 -0
  15. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Debug.py +0 -0
  16. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Env.py +0 -0
  17. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/FieldTypes.py +0 -0
  18. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/HtmlElement.py +0 -0
  19. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Localization.py +0 -0
  20. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Messages.py +0 -0
  21. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/MiddleWare.py +0 -0
  22. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Migration.py +0 -0
  23. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/ORM.py +0 -0
  24. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Queue.py +0 -0
  25. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Request.py +0 -0
  26. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Response.py +0 -0
  27. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Router.py +0 -0
  28. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Session.py +0 -0
  29. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/ShellColors.py +0 -0
  30. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Swagger.py +0 -0
  31. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Testing.py +0 -0
  32. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/WSDL.py +0 -0
  33. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Webserver.py +0 -0
  34. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/Websocket.py +0 -0
  35. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/messages.pot +0 -0
  36. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/public/css/readme.md +0 -0
  37. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/public/favicon.ico +0 -0
  38. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/public/images/403.png +0 -0
  39. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/public/images/404.png +0 -0
  40. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/public/images/500.png +0 -0
  41. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/public/images/logo.png +0 -0
  42. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/public/images/readme.md +0 -0
  43. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/public/js/readme.md +0 -0
  44. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/public/js/reconnecting-websocket.js +0 -0
  45. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/public/js/tina4helper.js +0 -0
  46. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/public/swagger/index.html +0 -0
  47. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/public/swagger/oauth2-redirect.html +0 -0
  48. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/templates/components/crud.twig +0 -0
  49. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/templates/errors/403.twig +0 -0
  50. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/templates/errors/404.twig +0 -0
  51. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/templates/errors/500.twig +0 -0
  52. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/templates/readme.md +0 -0
  53. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/translations/en/LC_MESSAGES/messages.mo +0 -0
  54. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/translations/en/LC_MESSAGES/messages.po +0 -0
  55. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/translations/fr/LC_MESSAGES/messages.mo +0 -0
  56. {tina4_python-0.2.150 → tina4_python-0.2.152}/tina4_python/translations/fr/LC_MESSAGES/messages.po +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tina4-python
3
- Version: 0.2.150
3
+ Version: 0.2.152
4
4
  Summary: Tina4Python - This is not another framework for Python
5
5
  Author-email: Andre van Zuydam <andrevanzuydam@gmail.com>
6
6
  Requires-Python: <4.0,>=3.12
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tina4-python"
3
- version = "0.2.150"
3
+ version = "0.2.152"
4
4
  description = "Tina4Python - This is not another framework for Python"
5
5
  authors = [
6
6
  {name = "Andre van Zuydam",email = "andrevanzuydam@gmail.com"}
@@ -146,10 +146,11 @@ class Template:
146
146
 
147
147
  twig = Template.init_twig(tina4_python.root_path + os.sep + "src" + os.sep + "templates")
148
148
  try:
149
- if twig.get_template(template_or_file_name):
150
- template = twig.get_template(template_or_file_name)
151
- content = template.render(data)
152
- else:
149
+ try:
150
+ if twig.get_template(template_or_file_name):
151
+ template = twig.get_template(template_or_file_name)
152
+ content = template.render(data)
153
+ except:
153
154
  template = twig.from_string(template_or_file_name)
154
155
  content = template.render(data)
155
156
 
@@ -207,8 +208,6 @@ class Template:
207
208
  return {"content": content, "content_type": mime_type}
208
209
  except json.JSONDecodeError as e:
209
210
  return {"content": str(e), "content_type": ""}
210
-
211
-
212
211
  mime_type = "jpeg"
213
212
  # Check magic bytes on value
214
213
  if value[:4] == '/9j/':
@@ -137,8 +137,7 @@ def global_exception_handler(exception):
137
137
  tb_str = ''.join(traceback.format_exception(None, exception, exception.__traceback__))
138
138
  error_string = "Exception Error: " + error + "\n" + tb_str + "\nYou are seeing this error because Tina4 is in debug mode"
139
139
  Debug.error(error_string)
140
- if (os.getenv("TINA4_DEBUG_LEVEL", [Constant.TINA4_LOG_ALL]) == "[TINA4_LOG_ALL]"
141
- or debug_level in os.getenv("TINA4_DEBUG_LEVEL", [Constant.TINA4_LOG_ALL])):
140
+ if debug_level == "ALL" or debug_level is None or debug_level == "DEBUG":
142
141
  pass
143
142
  else:
144
143
  error_string = "An exception happened"
@@ -428,6 +427,11 @@ async def app(scope, receive, send):
428
427
  'type': 'http.response.body',
429
428
  'body': tina4_response.content,
430
429
  })
430
+ else:
431
+ if message["type"] == "websocket" and tina4_response.http_code != 200:
432
+ await send({
433
+ 'type': 'websocket.close',
434
+ })
431
435
 
432
436
 
433
437
  def run_web_server(hostname="localhost", port=7145, debug: bool = False):
@@ -532,10 +536,6 @@ def webserver(host_name, port, debug: bool = False):
532
536
 
533
537
  Debug.info(Messages.MSG_SERVER_STOPPED)
534
538
 
535
- Debug.info(Messages.MSG_SERVER_STOPPED)
536
-
537
-
538
-
539
539
  # Live coding hot-reload (jurigged)
540
540
  if importlib.util.find_spec("jurigged"):
541
541
  Debug.debug("Jurigged enabled")
@@ -65,7 +65,7 @@ async def index(request, response):
65
65
  return response(f"OK")
66
66
 
67
67
  if __name__ == "__main__":
68
- run_web_server()
68
+ run_web_server("0.0.0.0", 7145)
69
69
  '''
70
70
  app_py.write_text(app_content, encoding="utf-8")
71
71
 
@@ -143,7 +143,7 @@ COPY --from=builder /usr/local/bin /usr/local/bin
143
143
  # Copy application code
144
144
  COPY --from=builder /app /app
145
145
 
146
- EXPOSE 8080
146
+ EXPOSE 7145
147
147
 
148
148
  # Swagger defaults (override with env vars in docker-compose/k8s if needed)
149
149
  ENV SWAGGER_TITLE="Tina4 API"
@@ -151,7 +151,7 @@ ENV SWAGGER_VERSION="0.1.0"
151
151
  ENV SWAGGER_DESCRIPTION="Auto-generated API documentation"
152
152
 
153
153
  # Start the server on all interfaces
154
- CMD ["python3", "app.py", "0.0.0.0:8080", "-u"]
154
+ CMD ["python3", "app.py", "0.0.0.0:7145", "-u"]
155
155
  '''
156
156
  dockerfile_path.write_text(dockerfile_content, encoding="utf-8")
157
157
  print("Dockerfile created (multi-stage + uv)")
@@ -164,11 +164,11 @@ CMD ["python3", "app.py", "0.0.0.0:8080", "-u"]
164
164
  print(f"\nNext steps:")
165
165
  print(f" cd {project_path.relative_to(Path.cwd())}")
166
166
  print(f" python app.py # local development")
167
- print(f" docker build -t {project_path.name} . && docker run -p 8080:8080 {project_path.name}")
167
+ print(f" docker build -t {project_path.name} . && docker run -p 7145:7145 {project_path.name}")
168
168
  else:
169
169
  print("\nYou are already in the project folder. Run:")
170
170
  print(" python app.py # development")
171
- print(" docker build -t myapp . && docker run -p 8080:8080 myapp")
171
+ print(" docker build -t myapp . && docker run -p 7145:7145 myapp")
172
172
 
173
173
 
174
174
  def run_server(port: int = 8000):
File without changes