tina4-python 0.1.63__tar.gz → 0.1.65__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 (35) hide show
  1. {tina4_python-0.1.63 → tina4_python-0.1.65}/PKG-INFO +49 -10
  2. {tina4_python-0.1.63 → tina4_python-0.1.65}/README.md +378 -339
  3. {tina4_python-0.1.63 → tina4_python-0.1.65}/pyproject.toml +27 -27
  4. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/Auth.py +155 -155
  5. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/Constant.py +38 -38
  6. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/Database.py +307 -364
  7. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/DatabaseResult.py +41 -39
  8. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/Debug.py +46 -46
  9. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/Env.py +32 -32
  10. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/Localization.py +42 -42
  11. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/Messages.py +30 -30
  12. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/Migration.py +58 -59
  13. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/Request.py +21 -21
  14. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/Response.py +40 -40
  15. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/Router.py +212 -212
  16. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/Session.py +115 -115
  17. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/ShellColors.py +20 -20
  18. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/Template.py +48 -48
  19. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/Webserver.py +229 -229
  20. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/__init__.py +181 -181
  21. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/messages.pot +83 -83
  22. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/templates/errors/403.twig +10 -10
  23. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/templates/errors/404.twig +10 -10
  24. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/translations/en/LC_MESSAGES/messages.po +80 -80
  25. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/translations/fr/LC_MESSAGES/messages.po +84 -84
  26. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/public/css/readme.md +0 -0
  27. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/public/favicon.ico +0 -0
  28. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/public/images/403.png +0 -0
  29. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/public/images/404.png +0 -0
  30. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/public/images/logo.png +0 -0
  31. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/public/images/readme.md +0 -0
  32. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/public/js/readme.md +0 -0
  33. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/templates/readme.md +0 -0
  34. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/translations/en/LC_MESSAGES/messages.mo +0 -0
  35. {tina4_python-0.1.63 → tina4_python-0.1.65}/tina4_python/translations/fr/LC_MESSAGES/messages.mo +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tina4-python
3
- Version: 0.1.63
3
+ Version: 0.1.65
4
4
  Summary: Tina4Python - This is not another framework for Python
5
5
  Author: Andre van Zuydam
6
6
  Author-email: andrevanzuydam@gmail.com
@@ -56,6 +56,22 @@ If you are developing on Tina4, make sure you copy the public folder from tina4_
56
56
 
57
57
  ### Installation
58
58
 
59
+ Virtual environment
60
+
61
+ Linux / Mac
62
+ ```bash
63
+ python3 -m venv venv
64
+ source ./venv/bin/activate
65
+ pip install poetry
66
+ ```
67
+
68
+ Windows
69
+ ```bash
70
+ python -m venv venv
71
+ .\venv\Scripts\activate
72
+ pip install poetry
73
+ ```
74
+
59
75
  #### Windows
60
76
 
61
77
  1.) Install Poetry:
@@ -246,23 +262,24 @@ API_KEY=somehash
246
262
 
247
263
  ```bash
248
264
 
265
+ Various databases initialised:
266
+
249
267
  dba = Database("sqlite3:test.db", "username", "password")
250
268
  dba = Database("mysql:localhost/3306:myschema", "username", "password")
251
269
  dba = Database("postgres:localhost/5432:myschema", "username", "password")
252
270
  dba = Database("firebird:localhost/3050:/home/database/FIREBIRD.FDB", "username", "password")
253
271
 
254
- NoSQL support
272
+ NoSQL support (Still to be developed):
255
273
 
256
274
  dba = Database("mongodb:localhost/27017:mycollection", "username", "password")
257
275
  dba = Database("firebase:https://your_storage.firebaseio.com", "username", "password")
258
276
 
277
+ Fetching records and passing data as parameters, limit and skip specified:
259
278
 
260
279
  records = dba.fetch("select * from table where something = ? and something2 = ?", params=["something", "something2"], limit=10, skip=5)
261
280
 
262
281
  print (records)
263
-
264
282
  print (records.to_json())
265
-
266
283
  {
267
284
  id : 1
268
285
  something: "something",
@@ -270,7 +287,6 @@ print (records.to_json())
270
287
  }
271
288
 
272
289
  print(records[0].id)
273
-
274
290
  1
275
291
 
276
292
  record = dba.fetch_one("select * from table where something = ? and something2 = ?", params=["something", "something2"])
@@ -278,18 +294,32 @@ record = dba.fetch_one("select * from table where something = ? and something2 =
278
294
  print(record.id)
279
295
 
280
296
  print (records.to_json())
281
-
282
297
  1
283
298
 
299
+
300
+ Executing sql queries:
301
+
284
302
  dba.execute ("update table set something = ? and something2 = ? where id = ?", params=["something", "something2", 1])
285
303
  dba.execute ("delete from table where id = ?", params=[1])
286
304
 
305
+
306
+ Starting a transaction:
307
+
287
308
  dba.start_transaction()
288
309
 
310
+
311
+ Rollback a transaction:
312
+
289
313
  dba.roll_back()
290
314
 
315
+
316
+ Commit a transaction:
317
+
291
318
  dba.commit()
292
319
 
320
+
321
+ Select method (Still in development):
322
+
293
323
  dba.select(["id", "something", "something2"], "table_name", filter={"id": 1}, limit=10, skip=0)
294
324
  dba.select(["id", "something", "something2"], "table_name", filter=[{"id": 1}, {"id": 2}], limit=10, skip=0)
295
325
  dba.select(["id", "something", "sum(id)"])
@@ -302,23 +332,32 @@ dba.select(["id", "something", "sum(id)"])
302
332
  .group_by()
303
333
  .order_by(["id"])
304
334
 
335
+
336
+ Updating records - records will be found by primary key specified and then updated:
337
+
305
338
  dba.update(table_name="table_name", records.fromJSON(json_string))
306
339
  dba.update(table_name="table_name", records, primary_key="id")
307
-
308
340
  dba.update(table_name="table_name", record, primary_key="id") # primary key implied by first key value pair
341
+
342
+
343
+ Inserting records - pass a dictionary for a single record and a list of dictionaries for multiple records:
344
+
309
345
  dba.insert(table_name="table_name", dba.from_json(json_string))
310
346
  dba.insert(table_name="table_name", {"id": 1, "something": "hello", "something2": "world"})
311
347
  dba.insert(table_name="table_name", [{"id": 1, "something": "hello", "something2": "world"},
312
348
  {"id": 2, "something": "hello2", "something2": "world2"}])
313
349
 
350
+
351
+ Deleting records - specify table name. Records can either be found by primary key or filter:
352
+
314
353
  dba.delete("table_name", record, primary_key="id")
315
354
  dba.delete("table_name", filter={"id": 1})
316
-
317
355
  dba.delete("table_name", filter=[{"id": 1}, {"id": 2}])
318
356
 
357
+ Migration updates:
319
358
 
320
-
321
-
359
+ - record count added
360
+ - Database result object updated
322
361
  ```
323
362
 
324
363