tina4-python 0.2.144__tar.gz → 0.2.145__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.144 → tina4_python-0.2.145}/PKG-INFO +1 -1
  2. {tina4_python-0.2.144 → tina4_python-0.2.145}/pyproject.toml +1 -1
  3. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Swagger.py +31 -7
  4. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/__init__.py +10 -9
  5. {tina4_python-0.2.144 → tina4_python-0.2.145}/.gitignore +0 -0
  6. {tina4_python-0.2.144 → tina4_python-0.2.145}/README.md +0 -0
  7. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Api.py +0 -0
  8. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Auth.py +0 -0
  9. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/CRUD.py +0 -0
  10. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Constant.py +0 -0
  11. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Database.py +0 -0
  12. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/DatabaseResult.py +0 -0
  13. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/DatabaseTypes.py +0 -0
  14. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Debug.py +0 -0
  15. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Env.py +0 -0
  16. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/FieldTypes.py +0 -0
  17. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/HtmlElement.py +0 -0
  18. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Localization.py +0 -0
  19. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Messages.py +0 -0
  20. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/MiddleWare.py +0 -0
  21. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Migration.py +0 -0
  22. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/ORM.py +0 -0
  23. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Queue.py +0 -0
  24. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Request.py +0 -0
  25. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Response.py +0 -0
  26. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Router.py +0 -0
  27. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Session.py +0 -0
  28. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/ShellColors.py +0 -0
  29. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Template.py +0 -0
  30. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Testing.py +0 -0
  31. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/WSDL.py +0 -0
  32. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Webserver.py +0 -0
  33. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/Websocket.py +0 -0
  34. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/cli.py +0 -0
  35. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/messages.pot +0 -0
  36. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/public/css/readme.md +0 -0
  37. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/public/favicon.ico +0 -0
  38. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/public/images/403.png +0 -0
  39. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/public/images/404.png +0 -0
  40. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/public/images/500.png +0 -0
  41. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/public/images/logo.png +0 -0
  42. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/public/images/readme.md +0 -0
  43. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/public/js/readme.md +0 -0
  44. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/public/js/reconnecting-websocket.js +0 -0
  45. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/public/js/tina4helper.js +0 -0
  46. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/public/swagger/index.html +0 -0
  47. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/public/swagger/oauth2-redirect.html +0 -0
  48. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/templates/components/crud.twig +0 -0
  49. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/templates/errors/403.twig +0 -0
  50. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/templates/errors/404.twig +0 -0
  51. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/templates/errors/500.twig +0 -0
  52. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/templates/readme.md +0 -0
  53. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/translations/en/LC_MESSAGES/messages.mo +0 -0
  54. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/translations/en/LC_MESSAGES/messages.po +0 -0
  55. {tina4_python-0.2.144 → tina4_python-0.2.145}/tina4_python/translations/fr/LC_MESSAGES/messages.mo +0 -0
  56. {tina4_python-0.2.144 → tina4_python-0.2.145}/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.144
3
+ Version: 0.2.145
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.144"
3
+ version = "0.2.145"
4
4
  description = "Tina4Python - This is not another framework for Python"
5
5
  authors = [
6
6
  {name = "Andre van Zuydam",email = "andrevanzuydam@gmail.com"}
@@ -1,5 +1,5 @@
1
1
  #
2
- # Tina4 - This is not a 4ramework.
2
+ # Tina4 - This is not a framework.
3
3
  # Copyright 2007 - present Tina4
4
4
  # License: MIT https://opensource.org/licenses/MIT
5
5
  #
@@ -10,8 +10,6 @@ from typing import List, Dict, Any, Optional, Callable
10
10
 
11
11
  import tina4_python
12
12
  from tina4_python import Constant
13
- from tina4_python.Debug import Debug
14
-
15
13
 
16
14
  class Swagger:
17
15
  """
@@ -39,6 +37,10 @@ class Swagger:
39
37
  def add_secure(callback: Callable) -> None:
40
38
  Swagger.set_swagger_value(callback, "secure", True)
41
39
 
40
+ @staticmethod
41
+ def add_noauth(callback: Callable) -> None:
42
+ Swagger.set_swagger_value(callback, "secure", False)
43
+
42
44
  @staticmethod
43
45
  def add_tags(tags: List[str] | str, callback: Callable) -> None:
44
46
  if isinstance(tags, str):
@@ -149,7 +151,7 @@ class Swagger:
149
151
  "content": {"application/json": {}}
150
152
  }
151
153
  },
152
- "security": [{"bearerAuth": []}] if secure else []
154
+ "security": [{"bearerAuth": []}, {"basicAuth": []}] if secure else []
153
155
  }
154
156
 
155
157
  # Clean None responses
@@ -183,7 +185,7 @@ class Swagger:
183
185
  "summary": "",
184
186
  "example": None,
185
187
  "example_response": None,
186
- "secure": False
188
+ # Note: 'secure' default is now set per-method in get_json
187
189
  }
188
190
  for key, value in defaults.items():
189
191
  if key not in swagger or swagger[key] is None:
@@ -207,20 +209,35 @@ class Swagger:
207
209
 
208
210
  for route in route_info.get("routes", []):
209
211
  for method in route_info.get("methods", []):
212
+ # Apply per-method secure default if not explicitly set
213
+ secured = swagger.get("secure")
214
+ if secured is None:
215
+ secured = method != Constant.TINA4_GET
216
+
217
+ route_noauth = route_info.get("noauth")
218
+ route_secure = route_info.get("secure")
219
+
220
+ if route_secure is not None and route_secure:
221
+ secured = True
222
+
223
+ if route_noauth is not None and route_noauth:
224
+ secured = False
225
+
226
+ swagger["secure"] = secured # Update for this operation
210
227
  operation = Swagger.get_swagger_entry(
211
228
  route=route,
212
229
  method=method,
213
230
  tags=swagger["tags"],
214
231
  summary=swagger["summary"],
215
232
  description=swagger["description"],
216
- secure=swagger["secure"],
233
+ secure=secure,
217
234
  query_params=swagger["params"],
218
235
  example=swagger["example"],
219
236
  example_response=swagger["example_response"]
220
237
  )
221
238
 
222
239
  # CRITICAL FIX: Re-apply security if route is marked secure
223
- if swagger["secure"]:
240
+ if secure:
224
241
  operation["security"] = [
225
242
  {"bearerAuth": []},
226
243
  {"basicAuth": []}
@@ -302,6 +319,13 @@ def secure():
302
319
  return decorator
303
320
 
304
321
 
322
+ def noauth():
323
+ def decorator(callback):
324
+ Swagger.add_noauth(callback)
325
+ return callback
326
+ return decorator
327
+
328
+
305
329
  def tags(tags: List[str] | str):
306
330
  def decorator(callback):
307
331
  Swagger.add_tags(tags, callback)
@@ -81,16 +81,17 @@ if not debug_level or debug_level in ("", "NONE", "NULL"):
81
81
  setup_logging()
82
82
  Debug.info("Environment is", environment)
83
83
 
84
- TINA4_BANNER = ShellColors.bright_magenta + """
85
- ████████╗██╗███╗ ██╗ █████╗ ██╗ ██╗
86
- ╚══██╔══╝██║████╗ ██║██╔══██╗██║ ██║
87
- ██║ ██║██╔██╗ ██║███████║███████║
88
- ██║ ██║██║╚██╗██║██╔══██║╚════██║
89
- ██║ ██║██║ ╚████║██║ ██║ ██║
90
- ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝
91
- """ + ShellColors.end
92
-
93
84
  try:
85
+ TINA4_BANNER = ShellColors.bright_magenta + """
86
+ ████████╗██╗███╗ ██╗ █████╗ ██╗ ██╗
87
+ ╚══██╔══╝██║████╗ ██║██╔══██╗██║ ██║
88
+ ██║ ██║██╔██╗ ██║███████║███████║
89
+ ██║ ██║██║╚██╗██║██╔══██║╚════██║
90
+ ██║ ██║██║ ╚████║██║ ██║ ██║
91
+ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝
92
+ """ + ShellColors.end
93
+
94
+
94
95
  print(TINA4_BANNER)
95
96
  except Exception as e:
96
97
  print(ShellColors.bright_magenta +"TINA4"+ShellColors.end)
File without changes