tina4-python 0.2.197__tar.gz → 0.2.198__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.197 → tina4_python-0.2.198}/.gitignore +10 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/PKG-INFO +1 -1
- {tina4_python-0.2.197 → tina4_python-0.2.198}/pyproject.toml +1 -1
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/CLAUDE.md +5 -1
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Swagger.py +4 -1
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/__init__.py +13 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/README.md +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Api.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Auth.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/CRUD.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Constant.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Database.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/DatabaseResult.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/DatabaseTypes.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Debug.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/DevReload.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Env.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/FieldTypes.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/HtmlElement.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Localization.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Messages.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/MiddleWare.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Migration.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/ORM.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Queue.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Request.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Response.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Router.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Session.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/ShellColors.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Template.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Testing.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/WSDL.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Webserver.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/Websocket.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/cli.py +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/messages.pot +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/public/css/readme.md +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/public/favicon.ico +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/public/images/403.png +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/public/images/404.png +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/public/images/500.png +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/public/images/logo.png +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/public/images/readme.md +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/public/js/readme.md +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/public/js/reconnecting-websocket.js +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/public/js/tina4helper.js +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/public/swagger/index.html +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/public/swagger/oauth2-redirect.html +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/templates/components/crud.twig +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/templates/errors/403.twig +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/templates/errors/404.twig +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/templates/errors/500.twig +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/templates/readme.md +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/af/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/af/LC_MESSAGES/messages.po +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/en/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/en/LC_MESSAGES/messages.po +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/es/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/es/LC_MESSAGES/messages.po +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/fr/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/fr/LC_MESSAGES/messages.po +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/ja/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/ja/LC_MESSAGES/messages.po +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/zh/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/zh/LC_MESSAGES/messages.po +0 -0
|
@@ -44,3 +44,13 @@ test_queue*.db
|
|
|
44
44
|
/publish.sh
|
|
45
45
|
/src/scss/
|
|
46
46
|
/broken
|
|
47
|
+
__pycache__/
|
|
48
|
+
.DS_Store
|
|
49
|
+
.coverage
|
|
50
|
+
/benchmarks/.env
|
|
51
|
+
/benchmarks/data.db
|
|
52
|
+
/benchmarks/logs/
|
|
53
|
+
/benchmarks/sessions/
|
|
54
|
+
/benchmarks/secrets/
|
|
55
|
+
/benchmarks/results/
|
|
56
|
+
/benchmarks/__pycache__/
|
|
@@ -254,7 +254,8 @@ Producer(Queue(topic="tasks")).produce({"action": "send_email"})
|
|
|
254
254
|
### 11. Key tina4_python Gotchas
|
|
255
255
|
|
|
256
256
|
1. **Database import**: Use `from tina4_python.Database import Database` (NOT `from tina4_python import Database`)
|
|
257
|
-
2. **noauth/secured import**: Use `from tina4_python import noauth` or `from tina4_python.Router import noauth` (there is NO `tina4_python.Decorators` module)
|
|
257
|
+
2. **noauth/secured import**: Use `from tina4_python import noauth` or `from tina4_python.Router import noauth` (there is NO `tina4_python.Decorators` module). **Never** import `noauth` from `tina4_python.Swagger` — that version only affects documentation, not actual auth.
|
|
258
|
+
2b. **Decorator ordering**: Route decorators (`@get`, `@post`, etc.) must be the **innermost** (closest to the function). Swagger/meta decorators (`@description`, `@tags`, `@noauth`, `@secured`) go above. Correct: `@noauth()` → `@description(...)` → `@post(...)` → `def handler`. Wrong: `@post(...)` → `@description(...)` → `def handler` (will crash).
|
|
258
259
|
3. **Jinja2 template syntax** (common mistakes):
|
|
259
260
|
- **No ternary operator**: Use `{% if x %}...{% endif %}` NOT `{{ x ? 'a' : 'b' }}`
|
|
260
261
|
- **elif not elseif**: Use `{% elif %}` NOT `{% elseif %}`
|
|
@@ -377,6 +378,7 @@ async def create_user(request, response):
|
|
|
377
378
|
from tina4_python.Router import post, get, noauth, secured
|
|
378
379
|
|
|
379
380
|
@noauth()
|
|
381
|
+
@description("Public webhook")
|
|
380
382
|
@post("/api/webhook")
|
|
381
383
|
async def public_webhook(request, response):
|
|
382
384
|
return response({"ok": True})
|
|
@@ -387,6 +389,8 @@ async def protected_get(request, response):
|
|
|
387
389
|
return response({"secret": True})
|
|
388
390
|
```
|
|
389
391
|
|
|
392
|
+
**Decorator order** (outermost → innermost): `@noauth`/`@secured` → `@description`/`@tags`/`@example` → `@get`/`@post`/`@put`/`@delete`
|
|
393
|
+
|
|
390
394
|
## Request Object
|
|
391
395
|
|
|
392
396
|
```python
|
|
@@ -21,7 +21,7 @@ class Swagger:
|
|
|
21
21
|
"""Internal helper to attach swagger metadata to a route callback"""
|
|
22
22
|
if callback not in tina4_python.tina4_routes:
|
|
23
23
|
tina4_python.tina4_routes[callback] = {"routes":[], "methods":[]}
|
|
24
|
-
if "swagger" not in tina4_python.tina4_routes[callback]:
|
|
24
|
+
if "swagger" not in tina4_python.tina4_routes[callback] or tina4_python.tina4_routes[callback]["swagger"] is None:
|
|
25
25
|
tina4_python.tina4_routes[callback]["swagger"] = {}
|
|
26
26
|
tina4_python.tina4_routes[callback]["swagger"][key_name] = value
|
|
27
27
|
|
|
@@ -370,6 +370,9 @@ def secure():
|
|
|
370
370
|
def noauth():
|
|
371
371
|
def decorator(callback):
|
|
372
372
|
Swagger.add_noauth(callback)
|
|
373
|
+
if callback not in tina4_python.tina4_routes:
|
|
374
|
+
tina4_python.tina4_routes[callback] = {"routes": [], "methods": []}
|
|
375
|
+
tina4_python.tina4_routes[callback]["noauth"] = True
|
|
373
376
|
return callback
|
|
374
377
|
return decorator
|
|
375
378
|
|
|
@@ -501,6 +501,7 @@ def run_web_server(hostname="localhost", port=7145, debug: bool = False):
|
|
|
501
501
|
• Automatically imports all Python files in ./src/ (recursive)
|
|
502
502
|
• Triggers @get, @post, etc. decorators with zero manual imports
|
|
503
503
|
• Hot-reload support via Hypercorn when debug=True
|
|
504
|
+
• CLI args override: ``python app.py 8080`` or ``python app.py localhost:8080``
|
|
504
505
|
• Fully backward compatible with existing projects
|
|
505
506
|
|
|
506
507
|
Example:
|
|
@@ -508,6 +509,18 @@ def run_web_server(hostname="localhost", port=7145, debug: bool = False):
|
|
|
508
509
|
"""
|
|
509
510
|
import sys
|
|
510
511
|
import importlib
|
|
512
|
+
|
|
513
|
+
# Allow CLI arguments to override hostname/port
|
|
514
|
+
if len(sys.argv) > 1:
|
|
515
|
+
arg = sys.argv[1].strip()
|
|
516
|
+
if ":" in arg:
|
|
517
|
+
h, _, p = arg.partition(":")
|
|
518
|
+
if h:
|
|
519
|
+
hostname = h
|
|
520
|
+
if p.isdigit():
|
|
521
|
+
port = int(p)
|
|
522
|
+
elif arg.isdigit():
|
|
523
|
+
port = int(arg)
|
|
511
524
|
from pathlib import Path
|
|
512
525
|
|
|
513
526
|
# ------------------------------------------------------------------
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/public/js/reconnecting-websocket.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/public/swagger/oauth2-redirect.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/af/LC_MESSAGES/messages.mo
RENAMED
|
File without changes
|
{tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/af/LC_MESSAGES/messages.po
RENAMED
|
File without changes
|
{tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/en/LC_MESSAGES/messages.mo
RENAMED
|
File without changes
|
{tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/en/LC_MESSAGES/messages.po
RENAMED
|
File without changes
|
{tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/es/LC_MESSAGES/messages.mo
RENAMED
|
File without changes
|
{tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/es/LC_MESSAGES/messages.po
RENAMED
|
File without changes
|
{tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/fr/LC_MESSAGES/messages.mo
RENAMED
|
File without changes
|
{tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/fr/LC_MESSAGES/messages.po
RENAMED
|
File without changes
|
{tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/ja/LC_MESSAGES/messages.mo
RENAMED
|
File without changes
|
{tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/ja/LC_MESSAGES/messages.po
RENAMED
|
File without changes
|
{tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/zh/LC_MESSAGES/messages.mo
RENAMED
|
File without changes
|
{tina4_python-0.2.197 → tina4_python-0.2.198}/tina4_python/translations/zh/LC_MESSAGES/messages.po
RENAMED
|
File without changes
|