dmart 0.1.10__py3-none-any.whl → 1.4.0__py3-none-any.whl
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.
- api/managed/utils.py +32 -30
- data_adapters/sql/adapter.py +3 -3
- {dmart-0.1.10.dist-info → dmart-1.4.0.dist-info}/METADATA +2 -3
- {dmart-0.1.10.dist-info → dmart-1.4.0.dist-info}/RECORD +11 -11
- languages/loader.py +0 -1
- plugins/system_notification_sender/plugin.py +1 -1
- utils/generate_email.py +0 -1
- utils/settings.py +2 -2
- {dmart-0.1.10.dist-info → dmart-1.4.0.dist-info}/WHEEL +0 -0
- {dmart-0.1.10.dist-info → dmart-1.4.0.dist-info}/entry_points.txt +0 -0
- {dmart-0.1.10.dist-info → dmart-1.4.0.dist-info}/top_level.txt +0 -0
api/managed/utils.py
CHANGED
|
@@ -469,22 +469,23 @@ async def serve_request_update(request, owner_shortname: str):
|
|
|
469
469
|
schema_shortname=record_schema_shortname,
|
|
470
470
|
)
|
|
471
471
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
if latest_history and latest_history.last_checksum_history != requested_checksum:
|
|
480
|
-
raise api.Exception(
|
|
481
|
-
status.HTTP_409_CONFLICT,
|
|
482
|
-
api.Error(
|
|
483
|
-
type="request",
|
|
484
|
-
code=InternalErrorCode.CONFLICT,
|
|
485
|
-
message="Resource has been updated by another request!",
|
|
486
|
-
),
|
|
472
|
+
if settings.is_sha_required:
|
|
473
|
+
requested_checksum = record.attributes.get("last_checksum_history")
|
|
474
|
+
if requested_checksum:
|
|
475
|
+
latest_history = await db.get_latest_history(
|
|
476
|
+
space_name=request.space_name,
|
|
477
|
+
subpath=record.subpath,
|
|
478
|
+
shortname=record.shortname,
|
|
487
479
|
)
|
|
480
|
+
if latest_history and latest_history.last_checksum_history != requested_checksum:
|
|
481
|
+
raise api.Exception(
|
|
482
|
+
status.HTTP_409_CONFLICT,
|
|
483
|
+
api.Error(
|
|
484
|
+
type="request",
|
|
485
|
+
code=InternalErrorCode.CONFLICT,
|
|
486
|
+
message="Resource has been updated by another request!",
|
|
487
|
+
),
|
|
488
|
+
)
|
|
488
489
|
|
|
489
490
|
# CHECK PERMISSION
|
|
490
491
|
if not await access_control.check_access(
|
|
@@ -1534,22 +1535,23 @@ async def serve_space_update(request, record, owner_shortname: str, is_replace:
|
|
|
1534
1535
|
user_shortname=owner_shortname,
|
|
1535
1536
|
)
|
|
1536
1537
|
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
if latest_history and latest_history.last_checksum_history != requested_checksum:
|
|
1545
|
-
raise api.Exception(
|
|
1546
|
-
status.HTTP_409_CONFLICT,
|
|
1547
|
-
api.Error(
|
|
1548
|
-
type="request",
|
|
1549
|
-
code=InternalErrorCode.CONFLICT,
|
|
1550
|
-
message="Resource has been updated by another request. Please refresh and try again.",
|
|
1551
|
-
),
|
|
1538
|
+
if settings.is_sha_required:
|
|
1539
|
+
requested_checksum = record.attributes.get("last_checksum_history")
|
|
1540
|
+
if requested_checksum:
|
|
1541
|
+
latest_history = await db.get_latest_history(
|
|
1542
|
+
space_name=space.shortname,
|
|
1543
|
+
subpath=record.subpath,
|
|
1544
|
+
shortname=space.shortname,
|
|
1552
1545
|
)
|
|
1546
|
+
if latest_history and latest_history.last_checksum_history != requested_checksum:
|
|
1547
|
+
raise api.Exception(
|
|
1548
|
+
status.HTTP_409_CONFLICT,
|
|
1549
|
+
api.Error(
|
|
1550
|
+
type="request",
|
|
1551
|
+
code=InternalErrorCode.CONFLICT,
|
|
1552
|
+
message="Resource has been updated by another request. Please refresh and try again.",
|
|
1553
|
+
),
|
|
1554
|
+
)
|
|
1553
1555
|
|
|
1554
1556
|
old_flat = flatten_dict(old_space.model_dump())
|
|
1555
1557
|
new_flat = flatten_dict(space.model_dump())
|
data_adapters/sql/adapter.py
CHANGED
|
@@ -1379,7 +1379,7 @@ class SQLAdapter(BaseDataAdapter):
|
|
|
1379
1379
|
ffv_resource_type.append(perm_key_splited[2])
|
|
1380
1380
|
|
|
1381
1381
|
if len(ffv_spaces):
|
|
1382
|
-
perm_key_splited_query = f'@space_name:{
|
|
1382
|
+
perm_key_splited_query = f'@space_name:{"|".join(ffv_spaces)} @subpath:/{"|/".join(ffv_subpath)} @resource_type:{"|".join(ffv_resource_type)} {" ".join(ffv_query)}'
|
|
1383
1383
|
if query.search:
|
|
1384
1384
|
query.search += f' {perm_key_splited_query}'
|
|
1385
1385
|
else:
|
|
@@ -2146,7 +2146,7 @@ class SQLAdapter(BaseDataAdapter):
|
|
|
2146
2146
|
|
|
2147
2147
|
return history_diff
|
|
2148
2148
|
except Exception as e:
|
|
2149
|
-
print("[!store_entry_diff]", e)
|
|
2149
|
+
print("[!store_entry_diff]", e, old_version_flattend, new_version_flattend)
|
|
2150
2150
|
logger.error(f"Failed parsing an entry. Error: {e}")
|
|
2151
2151
|
return {}
|
|
2152
2152
|
|
|
@@ -2466,7 +2466,7 @@ class SQLAdapter(BaseDataAdapter):
|
|
|
2466
2466
|
try:
|
|
2467
2467
|
return await self.load(space_name, "/", space_name, core.Space)
|
|
2468
2468
|
except Exception as e:
|
|
2469
|
-
print("[!fetch_space]", e)
|
|
2469
|
+
print("[!fetch_space]", e, space_name)
|
|
2470
2470
|
return None
|
|
2471
2471
|
|
|
2472
2472
|
async def set_user_session(self, user_shortname: str, token: str) -> bool:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dmart
|
|
3
|
-
Version:
|
|
4
|
-
Requires-Python: >=3.
|
|
3
|
+
Version: 1.4.0
|
|
4
|
+
Requires-Python: >=3.11
|
|
5
5
|
Requires-Dist: fastapi
|
|
6
6
|
Requires-Dist: pydantic
|
|
7
7
|
Requires-Dist: pydantic[email]
|
|
@@ -19,7 +19,6 @@ Requires-Dist: pydantic-settings
|
|
|
19
19
|
Requires-Dist: fastapi-sso
|
|
20
20
|
Requires-Dist: sqlmodel
|
|
21
21
|
Requires-Dist: psycopg[binary]
|
|
22
|
-
Requires-Dist: asyncpg
|
|
23
22
|
Requires-Dist: greenlet
|
|
24
23
|
Requires-Dist: alembic
|
|
25
24
|
Requires-Dist: jinja2
|
|
@@ -40,7 +40,7 @@ api/info/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
40
40
|
api/info/router.py,sha256=sQZZor7A-uDzsJX39aqEA7bMZOJ-WTitYeFvVNWfaHw,3938
|
|
41
41
|
api/managed/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
42
42
|
api/managed/router.py,sha256=0xfJ3NXV3XHyG8yWLEECBJt-XppymOxYuMDvQJdO1MI,50865
|
|
43
|
-
api/managed/utils.py,sha256=
|
|
43
|
+
api/managed/utils.py,sha256=KyDqnGK_ndX2Uy47FmrPHmu6PpZ35IhgjGjA816x-uY,72841
|
|
44
44
|
api/public/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
45
45
|
api/public/router.py,sha256=TrraWs2LGL_c_JRDbvS8OHm3fJ-ZKF7o4El7wvjV4Mk,24753
|
|
46
46
|
api/qr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -70,7 +70,7 @@ data_adapters/file/drop_index.py,sha256=OK3wXwaO9tUcHcJjqyLeBnkElzK35MZMi8YLGWdr
|
|
|
70
70
|
data_adapters/file/health_check.py,sha256=cMvwsXhjEykjrTyB3HtUn8QqKdtB_h5w8mGOEYPepzU,24221
|
|
71
71
|
data_adapters/file/redis_services.py,sha256=83STcca5fYFaEVLRYAxfUQXeUQZqJOT8XH-GBSbkR-E,39914
|
|
72
72
|
data_adapters/sql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
73
|
-
data_adapters/sql/adapter.py,sha256=
|
|
73
|
+
data_adapters/sql/adapter.py,sha256=MlNRWjUigjjS2SRzDYNaUOsGwTFPHZQn-o0DXxKKHl8,154565
|
|
74
74
|
data_adapters/sql/adapter_helpers.py,sha256=Eu22NElz2fMu6zyOsGsGrnAZcyWhHz9I__RJ9z6cwK0,15076
|
|
75
75
|
data_adapters/sql/create_tables.py,sha256=KqaXHTDOD8YaqGNc_e0iHHotd0WE3Kad_tBevtoGA20,17427
|
|
76
76
|
data_adapters/sql/create_users_folders.py,sha256=fm3P-CMcPX4b4DqXHKWMOtfX4RHdaev2nCDhYrS5cIs,1911
|
|
@@ -82,7 +82,7 @@ languages/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
82
82
|
languages/arabic.json,sha256=UL61rP9_M42CGfU94G5-1bXVUVnsJWXzoqhaXTXTJuM,910
|
|
83
83
|
languages/english.json,sha256=Y7eZ2X8c427_97qYrHOeGb2d725T-YlNNFVSi8FB7Kw,649
|
|
84
84
|
languages/kurdish.json,sha256=GgPLkVKyhIQjT7h3cPfDh0oyzg26znvBUe5X_Zz2TWI,864
|
|
85
|
-
languages/loader.py,sha256=
|
|
85
|
+
languages/loader.py,sha256=3gf2WmfSQ-AVIpyLAm_5J5NcQlWqBxQHMjcUd04Pijs,381
|
|
86
86
|
models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
87
87
|
models/api.py,sha256=f5X56dudyEysPmDuI5grM2RRCXuIQoehaAB6wMAGG28,6473
|
|
88
88
|
models/core.py,sha256=tEb7cbnC71yE9SDluynj7dE3U8Ed-EbF3uRJizy-uuU,16880
|
|
@@ -103,7 +103,7 @@ plugins/redis_db_update/plugin.py,sha256=z05k1zNJgBnKPj-jrtMUeI9br75ZPlifbzL0Hxp
|
|
|
103
103
|
plugins/resource_folders_creation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
104
104
|
plugins/resource_folders_creation/plugin.py,sha256=OwYPtRjMt2esAAEdv1FjdZgjEz01yt2xOZQi3nB0kEQ,3327
|
|
105
105
|
plugins/system_notification_sender/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
106
|
-
plugins/system_notification_sender/plugin.py,sha256=
|
|
106
|
+
plugins/system_notification_sender/plugin.py,sha256=MUOujwyRJ3yQrXwZ-X4qSdx0ZNU2c-sYy0d0-U8twoA,8253
|
|
107
107
|
plugins/update_access_controls/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
108
108
|
plugins/update_access_controls/plugin.py,sha256=43UV4vg-zxBF_7Bv0AZH6gU0Bgy2ybapNK21wJTF05k,301
|
|
109
109
|
pytests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -121,7 +121,7 @@ utils/access_control.py,sha256=8cCKr-6bL-Shl8j8xtfjEykMPGy6wkbNz-NRwLCdx-Y,11757
|
|
|
121
121
|
utils/async_request.py,sha256=Lm2xGXLeph7P1_fLhhNJDhPubKT2ncFn_Ueft4JVoeI,255
|
|
122
122
|
utils/exporter.py,sha256=HjcZCzcuH6N6f7Gn2hkTEeEFyo-MfrsiZUYAE-9kkVQ,9718
|
|
123
123
|
utils/firebase_notifier.py,sha256=nAeCUo5Mtwxygwj8ONlw8ZAtL_ekdJBabvU0z2dZ3NY,2391
|
|
124
|
-
utils/generate_email.py,sha256=
|
|
124
|
+
utils/generate_email.py,sha256=25i1iNVDfyRDq7vvZVFkaTYfMZFkAg1ZVQO2GdK7yRQ,1122
|
|
125
125
|
utils/helpers.py,sha256=gNxLg09cclRWrKNBy2pwGZsxGA0iFS5iZ_nyra3SmnI,9928
|
|
126
126
|
utils/hypercorn_config.py,sha256=q28HGRLWo9wjOVF183WwFPs3HQo4Nexc7q_7dmSVHRI,311
|
|
127
127
|
utils/internal_error_code.py,sha256=KGlXPC5YruPmb0ORVY7U3EEVpBgSLuU4lHdXgwUVN2M,1637
|
|
@@ -135,15 +135,15 @@ utils/query_policies_helper.py,sha256=jBcNI_15P6LqVeWz6w9UMreLuNIc50GxqAf17KzxE8
|
|
|
135
135
|
utils/regex.py,sha256=cv9b_l_e8tz42mKckeeyDgypKqh2e71E28co2iuEVxA,2286
|
|
136
136
|
utils/repository.py,sha256=9L-IvQ0Js0SQ5OR-Rh0i2Wdu4H9H06r8eE84hfBIu7Q,18313
|
|
137
137
|
utils/router_helper.py,sha256=Tgoq3oakejdEeyeVieTNk38JsPZ8x5RuR0kw2THc1mI,604
|
|
138
|
-
utils/settings.py,sha256=
|
|
138
|
+
utils/settings.py,sha256=SIunwTJF0Ac9fUWRt3sUsgWzMkWk0RUryEANYuOJQ9k,5660
|
|
139
139
|
utils/sms_notifier.py,sha256=04D6D_ldk3S9SojI7_381pqLc8v9lligeNHAysohz7w,550
|
|
140
140
|
utils/social_sso.py,sha256=Dm1W6U9OwKbAeUwM-kwJBHFEoreeoN-s-RHdOZ1-cNg,2216
|
|
141
141
|
utils/ticket_sys_utils.py,sha256=9QAlW2iiy8KyxQRBDj_WmzS5kKb0aYJmGwd4qzmGVqo,7005
|
|
142
142
|
utils/web_notifier.py,sha256=QM87VVid2grC5lK3NdS1yzz0z1wXljr4GChJOeK86W4,843
|
|
143
143
|
utils/templates/activation.html.j2,sha256=XAMKCdoqONoc4ZQucD0yV-Pg5DlHHASZrTVItNS-iBE,640
|
|
144
144
|
utils/templates/reminder.html.j2,sha256=aoS8bTs56q4hjAZKsb0jV9c-PIURBELuBOpT_qPZNVU,639
|
|
145
|
-
dmart-
|
|
146
|
-
dmart-
|
|
147
|
-
dmart-
|
|
148
|
-
dmart-
|
|
149
|
-
dmart-
|
|
145
|
+
dmart-1.4.0.dist-info/METADATA,sha256=vxNYgfiH0Y8TWKyFOmiXTx69CA-SOILtIqnt2Mj-7kY,2068
|
|
146
|
+
dmart-1.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
147
|
+
dmart-1.4.0.dist-info/entry_points.txt,sha256=GjfoGh1bpxuU9HHGJzbtCFPNptHv9TryxHMN3uBSKpg,37
|
|
148
|
+
dmart-1.4.0.dist-info/top_level.txt,sha256=JTypu1r5v9v7ru-60JSSbnSMEESHFRMacpcz-rPJx_U,262
|
|
149
|
+
dmart-1.4.0.dist-info/RECORD,,
|
languages/loader.py
CHANGED
|
@@ -69,7 +69,7 @@ class Plugin(PluginBase):
|
|
|
69
69
|
retrieve_json_payload=True,
|
|
70
70
|
space_name="management",
|
|
71
71
|
subpath="notifications/system",
|
|
72
|
-
search=f"@payload.body.on_space:{data.space_name} @payload.body.on_subpath:{data.subpath.lstrip(
|
|
72
|
+
search=f"@payload.body.on_space:{data.space_name} @payload.body.on_subpath:{data.subpath.lstrip('/')} @payload.body.on_action:{data.action_type}",
|
|
73
73
|
limit=30,
|
|
74
74
|
offset=0
|
|
75
75
|
), "dmart")
|
utils/generate_email.py
CHANGED
utils/settings.py
CHANGED
|
@@ -5,7 +5,6 @@ import os
|
|
|
5
5
|
import re
|
|
6
6
|
import string
|
|
7
7
|
import random
|
|
8
|
-
import sys
|
|
9
8
|
from venv import logger
|
|
10
9
|
|
|
11
10
|
from pydantic import Field
|
|
@@ -78,6 +77,7 @@ class Settings(BaseSettings):
|
|
|
78
77
|
session_inactivity_ttl: int = 0 # Set initially to 0 to disable session timeout. Possible value : 60 * 60 * 24 * 7 # 7 days
|
|
79
78
|
request_timeout: int = 35 # In seconds the time of dmart requests.
|
|
80
79
|
jq_timeout: int = 2 # secs
|
|
80
|
+
is_sha_required: bool = False
|
|
81
81
|
|
|
82
82
|
url_shorter_expires: int = 60 * 60 * 48 # 48 hours
|
|
83
83
|
|
|
@@ -157,7 +157,7 @@ try:
|
|
|
157
157
|
Settings()
|
|
158
158
|
)
|
|
159
159
|
except Exception as e:
|
|
160
|
-
|
|
160
|
+
logger.error(f"Failed to load settings.\nError: {e}")
|
|
161
161
|
# sys.exit(1)
|
|
162
162
|
pass
|
|
163
163
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|