tina4-python 0.2.130__tar.gz → 0.2.131__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.130 → tina4_python-0.2.131}/PKG-INFO +1 -1
- {tina4_python-0.2.130 → tina4_python-0.2.131}/pyproject.toml +1 -1
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/DatabaseResult.py +17 -5
- {tina4_python-0.2.130 → tina4_python-0.2.131}/.gitignore +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/README.md +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/Auth.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/CRUD.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/Constant.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/Database.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/DatabaseTypes.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/Debug.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/Env.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/HtmlElement.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/Localization.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/Messages.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/MiddleWare.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/Migration.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/ORM.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/Queue.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/Request.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/Response.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/Router.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/Session.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/ShellColors.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/Swagger.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/Template.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/Webserver.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/Websocket.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/__init__.py +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/messages.pot +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/public/css/readme.md +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/public/favicon.ico +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/public/images/403.png +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/public/images/404.png +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/public/images/500.png +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/public/images/logo.png +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/public/images/readme.md +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/public/js/readme.md +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/public/js/reconnecting-websocket.js +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/public/js/tina4helper.js +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/public/swagger/index.html +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/public/swagger/oauth2-redirect.html +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/templates/components/crud.twig +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/templates/errors/403.twig +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/templates/errors/404.twig +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/templates/errors/500.twig +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/templates/readme.md +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/translations/en/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/translations/en/LC_MESSAGES/messages.po +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/translations/fr/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/translations/fr/LC_MESSAGES/messages.po +0 -0
|
@@ -4,11 +4,10 @@
|
|
|
4
4
|
# License: MIT https://opensource.org/licenses/MIT
|
|
5
5
|
#
|
|
6
6
|
# flake8: noqa: E501
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import datetime
|
|
10
|
-
from decimal import Decimal
|
|
7
|
+
import csv
|
|
8
|
+
import io
|
|
11
9
|
from tina4_python.CRUD import CRUD
|
|
10
|
+
|
|
12
11
|
class DatabaseResult(CRUD):
|
|
13
12
|
def __init__(self, _records=None, _columns=None, _error=None, count=None, limit=None, skip=None, sql=None, dba=None):
|
|
14
13
|
"""
|
|
@@ -64,4 +63,17 @@ class DatabaseResult(CRUD):
|
|
|
64
63
|
|
|
65
64
|
|
|
66
65
|
|
|
67
|
-
|
|
66
|
+
def to_csv(self):
|
|
67
|
+
if not self.columns:
|
|
68
|
+
return ''
|
|
69
|
+
output = io.StringIO()
|
|
70
|
+
writer = csv.writer(output)
|
|
71
|
+
writer.writerow(self.columns)
|
|
72
|
+
if self.records:
|
|
73
|
+
first_record = self.records[0]
|
|
74
|
+
if isinstance(first_record, dict):
|
|
75
|
+
rows = [[str(row.get(col, '')) for col in self.columns] for row in self.records]
|
|
76
|
+
else:
|
|
77
|
+
rows = [list(map(str, row)) for row in self.records]
|
|
78
|
+
writer.writerows(rows)
|
|
79
|
+
return output.getvalue()
|
|
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.130 → tina4_python-0.2.131}/tina4_python/public/js/reconnecting-websocket.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tina4_python-0.2.130 → tina4_python-0.2.131}/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.130 → tina4_python-0.2.131}/tina4_python/translations/en/LC_MESSAGES/messages.mo
RENAMED
|
File without changes
|
{tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/translations/en/LC_MESSAGES/messages.po
RENAMED
|
File without changes
|
{tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/translations/fr/LC_MESSAGES/messages.mo
RENAMED
|
File without changes
|
{tina4_python-0.2.130 → tina4_python-0.2.131}/tina4_python/translations/fr/LC_MESSAGES/messages.po
RENAMED
|
File without changes
|