tina4-python 0.2.65__tar.gz → 0.2.66__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.65 → tina4_python-0.2.66}/PKG-INFO +1 -1
- {tina4_python-0.2.65 → tina4_python-0.2.66}/pyproject.toml +1 -1
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/Database.py +3 -35
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/ORM.py +4 -2
- {tina4_python-0.2.65 → tina4_python-0.2.66}/README.md +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/Auth.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/Constant.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/DatabaseResult.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/Debug.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/Env.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/Localization.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/Messages.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/MiddleWare.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/Migration.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/Queue.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/Request.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/Response.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/Router.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/Session.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/ShellColors.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/Swagger.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/Template.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/Webserver.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/__init__.py +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/messages.pot +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/public/css/readme.md +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/public/favicon.ico +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/public/images/403.png +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/public/images/404.png +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/public/images/500.png +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/public/images/logo.png +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/public/images/readme.md +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/public/js/readme.md +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/public/js/tina4helper.js +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/public/swagger/index.html +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/public/swagger/oauth2-redirect.html +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/templates/errors/403.twig +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/templates/errors/404.twig +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/templates/errors/500.twig +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/templates/readme.md +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/translations/en/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/translations/en/LC_MESSAGES/messages.po +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/translations/fr/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/translations/fr/LC_MESSAGES/messages.po +0 -0
|
@@ -223,18 +223,6 @@ class Database:
|
|
|
223
223
|
return False
|
|
224
224
|
return True
|
|
225
225
|
|
|
226
|
-
def check_connected(self):
|
|
227
|
-
"""
|
|
228
|
-
Checks if the database connection is established
|
|
229
|
-
:return:
|
|
230
|
-
"""
|
|
231
|
-
if self.database_engine == self.MYSQL:
|
|
232
|
-
self.dba.ping(reconnect=True, attempts=1, delay=0)
|
|
233
|
-
else:
|
|
234
|
-
# implement other database requirements if needed
|
|
235
|
-
pass
|
|
236
|
-
|
|
237
|
-
|
|
238
226
|
def fetch(self, sql, params=[], limit=10, skip=0):
|
|
239
227
|
"""
|
|
240
228
|
Fetch records based on a sql statement
|
|
@@ -244,7 +232,6 @@ class Database:
|
|
|
244
232
|
:param int skip: Offset of records to skip
|
|
245
233
|
:return: DatabaseResult
|
|
246
234
|
"""
|
|
247
|
-
self.check_connected()
|
|
248
235
|
# make a statement to count the records
|
|
249
236
|
sql_count = f"select count(*) as \"count_records\" from ({sql}) as t"
|
|
250
237
|
|
|
@@ -328,7 +315,6 @@ class Database:
|
|
|
328
315
|
:param list params: A list of params in order of precedence
|
|
329
316
|
:return: DatabaseResult
|
|
330
317
|
"""
|
|
331
|
-
self.check_connected()
|
|
332
318
|
sql = self.parse_place_holders(sql)
|
|
333
319
|
cursor = self.dba.cursor()
|
|
334
320
|
# Running an execute statement and committing any changes to the database
|
|
@@ -355,7 +341,6 @@ class Database:
|
|
|
355
341
|
:param params: A list of params in order of precedence
|
|
356
342
|
:return: DatabaseResult
|
|
357
343
|
"""
|
|
358
|
-
self.check_connected()
|
|
359
344
|
sql = self.parse_place_holders(sql)
|
|
360
345
|
cursor = self.dba.cursor()
|
|
361
346
|
# Running an execute statement and committing any changes to the database
|
|
@@ -374,7 +359,6 @@ class Database:
|
|
|
374
359
|
:return:
|
|
375
360
|
"""
|
|
376
361
|
try:
|
|
377
|
-
self.check_connected()
|
|
378
362
|
if self.database_engine == self.SQLITE:
|
|
379
363
|
self.dba.execute("BEGIN TRANSACTION")
|
|
380
364
|
elif self.database_engine == self.FIREBIRD:
|
|
@@ -442,13 +426,7 @@ class Database:
|
|
|
442
426
|
|
|
443
427
|
if isinstance(data, list):
|
|
444
428
|
columns = ", ".join(data[0].keys())
|
|
445
|
-
|
|
446
|
-
if self.database_engine in (self.SQLITE, self.FIREBIRD):
|
|
447
|
-
placeholders = ", ".join(['?'] * len(data[0]))
|
|
448
|
-
elif self.database_engine in (self.MYSQL, self.POSTGRES):
|
|
449
|
-
placeholders = ", ".join(['%s'] * len(data[0]))
|
|
450
|
-
else:
|
|
451
|
-
placeholders = ", ".join(['?'] * len(data))
|
|
429
|
+
placeholders = ", ".join(['?'] * len(data[0]))
|
|
452
430
|
|
|
453
431
|
sql = f"INSERT INTO {table_name} ({columns}) VALUES ({placeholders})"
|
|
454
432
|
|
|
@@ -476,12 +454,7 @@ class Database:
|
|
|
476
454
|
:param str table_name: Name of table
|
|
477
455
|
:param str filter: Expression for deleting records
|
|
478
456
|
"""
|
|
479
|
-
|
|
480
|
-
placeholder = "?"
|
|
481
|
-
elif self.database_engine in (self.MYSQL, self.POSTGRES):
|
|
482
|
-
placeholder = "%s"
|
|
483
|
-
else:
|
|
484
|
-
placeholder = "?"
|
|
457
|
+
placeholder = "?"
|
|
485
458
|
|
|
486
459
|
if filter is not None:
|
|
487
460
|
# Updating a single record - record passed in is a dictionary
|
|
@@ -523,12 +496,7 @@ class Database:
|
|
|
523
496
|
:param None data: List or Dictionary containing the data to be inserted
|
|
524
497
|
:param str primary_key: The name of the primary key of the table
|
|
525
498
|
"""
|
|
526
|
-
|
|
527
|
-
placeholder = "?"
|
|
528
|
-
elif self.database_engine in (self.MYSQL, self.POSTGRES):
|
|
529
|
-
placeholder = "%s"
|
|
530
|
-
else:
|
|
531
|
-
placeholder = "?"
|
|
499
|
+
placeholder = "?"
|
|
532
500
|
|
|
533
501
|
if data is not None:
|
|
534
502
|
# Updating a single record - record passed in is a dictionary
|
|
@@ -11,6 +11,7 @@ import sys
|
|
|
11
11
|
import ast
|
|
12
12
|
import json
|
|
13
13
|
import os
|
|
14
|
+
from tina4_python import root_path
|
|
14
15
|
from tina4_python.Constant import TINA4_LOG_ERROR, TINA4_LOG_INFO
|
|
15
16
|
from tina4_python.Debug import Debug
|
|
16
17
|
|
|
@@ -20,8 +21,9 @@ def find_all_sub_classes(a_class):
|
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
def orm(dba):
|
|
24
|
+
|
|
23
25
|
Debug("Initializing ORM")
|
|
24
|
-
orm_path =
|
|
26
|
+
orm_path = root_path + os.sep + "src" + os.sep + "orm"
|
|
25
27
|
print("Path", orm_path)
|
|
26
28
|
|
|
27
29
|
if not os.path.exists(orm_path):
|
|
@@ -510,7 +512,7 @@ class ORM:
|
|
|
510
512
|
if self.__dba__ is not None:
|
|
511
513
|
result = self.__dba__.delete(sql, params)
|
|
512
514
|
|
|
513
|
-
if
|
|
515
|
+
if not result:
|
|
514
516
|
self.__dba__.rollback()
|
|
515
517
|
return False
|
|
516
518
|
else:
|
|
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.65 → tina4_python-0.2.66}/tina4_python/public/swagger/oauth2-redirect.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/translations/en/LC_MESSAGES/messages.mo
RENAMED
|
File without changes
|
{tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/translations/en/LC_MESSAGES/messages.po
RENAMED
|
File without changes
|
{tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/translations/fr/LC_MESSAGES/messages.mo
RENAMED
|
File without changes
|
{tina4_python-0.2.65 → tina4_python-0.2.66}/tina4_python/translations/fr/LC_MESSAGES/messages.po
RENAMED
|
File without changes
|