elody 0.0.178__tar.gz → 0.0.180__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.
- {elody-0.0.178 → elody-0.0.180}/PKG-INFO +1 -1
- {elody-0.0.178 → elody-0.0.180}/pyproject.toml +1 -1
- {elody-0.0.178 → elody-0.0.180}/src/elody/csv.py +13 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/job.py +38 -22
- {elody-0.0.178 → elody-0.0.180}/src/elody.egg-info/PKG-INFO +1 -1
- {elody-0.0.178 → elody-0.0.180}/LICENSE +0 -0
- {elody-0.0.178 → elody-0.0.180}/README.md +0 -0
- {elody-0.0.178 → elody-0.0.180}/setup.cfg +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/__init__.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/__init__.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/client.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/error_codes.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/exceptions.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/loader.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/migration/__init__.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/migration/base_object_migrator.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/object_configurations/__init__.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/object_configurations/base_object_configuration.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/object_configurations/elody_configuration.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/object_configurations/job_configuration.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/__init__.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/authentication/__init__.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/authentication/base_user_tenant_validation_policy.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/authentication/multi_tenant_policy.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/__init__.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/filter_generic_objects_policy.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/filter_generic_objects_policy_v2.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/generic_object_detail_policy.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/generic_object_mediafiles_policy.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/generic_object_metadata_policy.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/generic_object_relations_policy.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/generic_object_request_policy.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/generic_object_request_policy_v2.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/mediafile_derivatives_policy.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/mediafile_download_policy.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/multi_tenant_policy.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/tenant_request_policy.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/helpers.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/permission_handler.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/policies/tenant_id_resolver.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/schemas.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/util.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody/validator.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody.egg-info/SOURCES.txt +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody.egg-info/dependency_links.txt +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody.egg-info/requires.txt +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/elody.egg-info/top_level.txt +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/tests/__init_.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/tests/data.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/tests/unit/__init__.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/tests/unit/test_csv.py +0 -0
- {elody-0.0.178 → elody-0.0.180}/src/tests/unit/test_utils.py +0 -0
|
@@ -11,6 +11,7 @@ from elody.exceptions import (
|
|
|
11
11
|
)
|
|
12
12
|
from elody.validator import validate_json
|
|
13
13
|
from elody.schemas import entity_schema, mediafile_schema
|
|
14
|
+
from dateutil import parser
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
class CSVParser:
|
|
@@ -207,6 +208,16 @@ class CSVMultiObject(CSVParser):
|
|
|
207
208
|
return False
|
|
208
209
|
return bool(value)
|
|
209
210
|
|
|
211
|
+
def is_datetime(self, value):
|
|
212
|
+
try:
|
|
213
|
+
parser.parse(value)
|
|
214
|
+
return True
|
|
215
|
+
except (ValueError, TypeError):
|
|
216
|
+
return False
|
|
217
|
+
|
|
218
|
+
def parse_datetime(self, value):
|
|
219
|
+
return parser.parse(value)
|
|
220
|
+
|
|
210
221
|
def __fill_objects_from_csv(self):
|
|
211
222
|
indexed_dict = dict()
|
|
212
223
|
external_mediafiles_ids = []
|
|
@@ -300,6 +311,8 @@ class CSVMultiObject(CSVParser):
|
|
|
300
311
|
metadata_key = metadata_info.get("map_to", key)
|
|
301
312
|
indexed_dict[type][id].setdefault("metadata", list())
|
|
302
313
|
options = metadata_info.get("value_options")
|
|
314
|
+
if self.is_datetime(value):
|
|
315
|
+
value = self.parse_datetime(value)
|
|
303
316
|
if options and value not in options:
|
|
304
317
|
if "invalid_value" not in self.get_errors():
|
|
305
318
|
self.set_error("invalid_value", list())
|
|
@@ -6,7 +6,34 @@ _create = _config.crud()["creator"]
|
|
|
6
6
|
_post_crud_hook = _config.crud()["post_crud_hook"]
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
def
|
|
9
|
+
def add_document_to_job(
|
|
10
|
+
id,
|
|
11
|
+
id_of_document_job_was_initiated_for,
|
|
12
|
+
type_of_document_job_was_initiated_for,
|
|
13
|
+
*,
|
|
14
|
+
get_rabbit,
|
|
15
|
+
):
|
|
16
|
+
relations = []
|
|
17
|
+
if id_of_document_job_was_initiated_for and type_of_document_job_was_initiated_for:
|
|
18
|
+
relations.append(
|
|
19
|
+
{"key": id_of_document_job_was_initiated_for, "type": "isJobFor"}
|
|
20
|
+
)
|
|
21
|
+
document = {
|
|
22
|
+
"id": id,
|
|
23
|
+
"patch": {
|
|
24
|
+
"relations": (relations),
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
_post_crud_hook(crud="update", document=document, get_rabbit=get_rabbit)
|
|
28
|
+
__patch_document_job_was_initiated_for(
|
|
29
|
+
id,
|
|
30
|
+
id_of_document_job_was_initiated_for,
|
|
31
|
+
type_of_document_job_was_initiated_for,
|
|
32
|
+
get_rabbit,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def init_job(
|
|
10
37
|
name,
|
|
11
38
|
job_type,
|
|
12
39
|
*,
|
|
@@ -29,7 +56,7 @@ def start_job(
|
|
|
29
56
|
{
|
|
30
57
|
"metadata": [
|
|
31
58
|
{"key": "name", "value": name},
|
|
32
|
-
{"key": "status", "value": "
|
|
59
|
+
{"key": "status", "value": "queued"},
|
|
33
60
|
{"key": "type", "value": job_type},
|
|
34
61
|
],
|
|
35
62
|
"relations": relations,
|
|
@@ -44,6 +71,7 @@ def start_job(
|
|
|
44
71
|
crud="create", document=job, parent_id=parent_id, get_rabbit=get_rabbit
|
|
45
72
|
)
|
|
46
73
|
__patch_document_job_was_initiated_for(
|
|
74
|
+
job["_id"],
|
|
47
75
|
id_of_document_job_was_initiated_for,
|
|
48
76
|
type_of_document_job_was_initiated_for,
|
|
49
77
|
get_rabbit,
|
|
@@ -51,26 +79,22 @@ def start_job(
|
|
|
51
79
|
return job["_id"]
|
|
52
80
|
|
|
53
81
|
|
|
54
|
-
def
|
|
82
|
+
def start_job(
|
|
55
83
|
id,
|
|
56
|
-
id_of_document_job_was_initiated_for,
|
|
57
|
-
type_of_document_job_was_initiated_for,
|
|
84
|
+
id_of_document_job_was_initiated_for=None,
|
|
85
|
+
type_of_document_job_was_initiated_for=None,
|
|
58
86
|
*,
|
|
59
87
|
get_rabbit,
|
|
60
88
|
):
|
|
61
|
-
relations = []
|
|
62
|
-
if id_of_document_job_was_initiated_for and type_of_document_job_was_initiated_for:
|
|
63
|
-
relations.append(
|
|
64
|
-
{"key": id_of_document_job_was_initiated_for, "type": "isJobFor"}
|
|
65
|
-
)
|
|
66
89
|
document = {
|
|
67
90
|
"id": id,
|
|
68
91
|
"patch": {
|
|
69
|
-
"
|
|
92
|
+
"metadata": [{"key": "status", "value": "running"}],
|
|
93
|
+
"relations": ([] if id_of_document_job_was_initiated_for else []),
|
|
70
94
|
},
|
|
71
95
|
}
|
|
72
96
|
_post_crud_hook(crud="update", document=document, get_rabbit=get_rabbit)
|
|
73
|
-
|
|
97
|
+
__patch_document_job_was_initiated_for(
|
|
74
98
|
id,
|
|
75
99
|
id_of_document_job_was_initiated_for,
|
|
76
100
|
type_of_document_job_was_initiated_for,
|
|
@@ -94,6 +118,7 @@ def finish_job(
|
|
|
94
118
|
}
|
|
95
119
|
_post_crud_hook(crud="update", document=document, get_rabbit=get_rabbit)
|
|
96
120
|
__patch_document_job_was_initiated_for(
|
|
121
|
+
id,
|
|
97
122
|
id_of_document_job_was_initiated_for,
|
|
98
123
|
type_of_document_job_was_initiated_for,
|
|
99
124
|
get_rabbit,
|
|
@@ -113,16 +138,7 @@ def fail_job(id, exception_message, *, get_rabbit):
|
|
|
113
138
|
_post_crud_hook(crud="update", document=document, get_rabbit=get_rabbit)
|
|
114
139
|
|
|
115
140
|
|
|
116
|
-
def __patch_document_job_was_initiated_for(
|
|
117
|
-
if id and type:
|
|
118
|
-
document = {
|
|
119
|
-
"document_info_job_was_initiated_for": {"id": id, "type": type},
|
|
120
|
-
"patch": {"relations": [{"key": id, "type": "hasJob"}]},
|
|
121
|
-
}
|
|
122
|
-
_post_crud_hook(crud="update", document=document, get_rabbit=get_rabbit)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
def __patch_document_job_was_initiated_for_v2(job_id, document_id, type, get_rabbit):
|
|
141
|
+
def __patch_document_job_was_initiated_for(job_id, document_id, type, get_rabbit):
|
|
126
142
|
if id and type:
|
|
127
143
|
document = {
|
|
128
144
|
"document_info_job_was_initiated_for": {"id": document_id, "type": type},
|
|
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
|
{elody-0.0.178 → elody-0.0.180}/src/elody/object_configurations/base_object_configuration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/filter_generic_objects_policy.py
RENAMED
|
File without changes
|
{elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/filter_generic_objects_policy_v2.py
RENAMED
|
File without changes
|
{elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/generic_object_detail_policy.py
RENAMED
|
File without changes
|
{elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/generic_object_mediafiles_policy.py
RENAMED
|
File without changes
|
{elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/generic_object_metadata_policy.py
RENAMED
|
File without changes
|
{elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/generic_object_relations_policy.py
RENAMED
|
File without changes
|
{elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/generic_object_request_policy.py
RENAMED
|
File without changes
|
{elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/generic_object_request_policy_v2.py
RENAMED
|
File without changes
|
{elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/mediafile_derivatives_policy.py
RENAMED
|
File without changes
|
{elody-0.0.178 → elody-0.0.180}/src/elody/policies/authorization/mediafile_download_policy.py
RENAMED
|
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
|