oarepo-runtime 1.2.20__tar.gz → 1.2.21__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {oarepo-runtime-1.2.20/oarepo_runtime.egg-info → oarepo-runtime-1.2.21}/PKG-INFO +1 -1
- oarepo-runtime-1.2.21/oarepo_runtime/relations/components.py +15 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/relations/mapping.py +10 -0
- oarepo-runtime-1.2.21/oarepo_runtime/relations/uow.py +7 -0
- oarepo-runtime-1.2.21/oarepo_runtime/validation/__init__.py +3 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/validation/dates.py +16 -2
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21/oarepo_runtime.egg-info}/PKG-INFO +1 -1
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime.egg-info/SOURCES.txt +2 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/setup.cfg +1 -1
- oarepo-runtime-1.2.20/oarepo_runtime/validation/__init__.py +0 -3
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/LICENSE +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/MANIFEST.in +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/README.md +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/__init__.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/cf/__init__.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/cf/cli.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/cf/mappings.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/cli/__init__.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/cli/base.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/cli/index.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/config/__init__.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/config/permissions_presets.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/config/service.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/__init__.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/batch.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/catalogue.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/cli.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/config.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/datastreams.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/errors.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/fixtures.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/readers/__init__.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/readers/excel.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/readers/json.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/readers/service.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/readers/yaml.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/transformers.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/writers/__init__.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/writers/service.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/writers/yaml.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/expansions/__init__.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/expansions/expandable_fields.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/expansions/service.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/ext.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/ext_config.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/facets/__init__.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/facets/base.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/facets/date.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/facets/enum.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/facets/max_facet.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/facets/nested_facet.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/i18n/__init__.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/i18n/schema.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/i18n/ui_schema.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/i18n/validation.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/relations/__init__.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/relations/base.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/relations/internal.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/relations/lookup.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/relations/pid_relation.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/tasks/__init__.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/tasks/datastreams.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/ui/__init__.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/ui/marshmallow.py +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime.egg-info/dependency_links.txt +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime.egg-info/entry_points.txt +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime.egg-info/requires.txt +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime.egg-info/top_level.txt +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/pyproject.toml +0 -0
- {oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/setup.py +0 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
from invenio_records_resources.services.records.components import ServiceComponent
|
2
|
+
|
3
|
+
from oarepo_runtime.relations import PIDRelation
|
4
|
+
from oarepo_runtime.relations.uow import CachingUnitOfWork
|
5
|
+
|
6
|
+
|
7
|
+
class CachingRelationsComponent(ServiceComponent):
|
8
|
+
def create(self, identity, *, record, **kwargs):
|
9
|
+
"""Create handler."""
|
10
|
+
# skutecny jmeno relations atributu
|
11
|
+
if isinstance(self.uow, CachingUnitOfWork) and hasattr(record, "relations"):
|
12
|
+
record.relations.set_cache(self.uow.cache)
|
13
|
+
def update(self, identity, *, record, **kwargs):
|
14
|
+
"""Update handler."""
|
15
|
+
self.create(identity, record=record, **kwargs)
|
@@ -1,3 +1,6 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
|
1
4
|
class RelationsMapping:
|
2
5
|
"""Helper class for managing relation fields."""
|
3
6
|
|
@@ -28,3 +31,10 @@ class RelationsMapping:
|
|
28
31
|
"""Clean dereferenced relation fields."""
|
29
32
|
for name in fields or self:
|
30
33
|
getattr(self, name).clean()
|
34
|
+
|
35
|
+
def set_cache(self, cache):
|
36
|
+
from oarepo_runtime.relations import PIDRelation
|
37
|
+
for key, fld in self._fields.items():
|
38
|
+
if isinstance(fld, PIDRelation):
|
39
|
+
fld.cache = cache
|
40
|
+
getattr(self, key).cache = cache
|
@@ -1,6 +1,8 @@
|
|
1
|
+
import functools
|
2
|
+
import re
|
1
3
|
from datetime import datetime
|
2
|
-
|
3
4
|
from marshmallow.exceptions import ValidationError
|
5
|
+
from marshmallow_utils.fields.edtfdatestring import EDTFValidator
|
4
6
|
|
5
7
|
|
6
8
|
def validate_date(date_format):
|
@@ -14,7 +16,6 @@ def validate_date(date_format):
|
|
14
16
|
|
15
17
|
return validate
|
16
18
|
|
17
|
-
|
18
19
|
def validate_datetime(value):
|
19
20
|
try:
|
20
21
|
datetime.fromisoformat(value)
|
@@ -22,3 +23,16 @@ def validate_datetime(value):
|
|
22
23
|
raise ValidationError(
|
23
24
|
f"Invalid datetime format, expecting iso format, got {value}"
|
24
25
|
) from e
|
26
|
+
|
27
|
+
class CachedMultilayerEDTFValidator(EDTFValidator):
|
28
|
+
|
29
|
+
@functools.lru_cache(maxsize=1024)
|
30
|
+
def __call__(self, value):
|
31
|
+
if re.match(r"^\d{4}$", value):
|
32
|
+
return value
|
33
|
+
try:
|
34
|
+
datetime.strptime(value, "%Y-%m-%d")
|
35
|
+
return value
|
36
|
+
except:
|
37
|
+
return super().__call__(value)
|
38
|
+
|
@@ -54,10 +54,12 @@ oarepo_runtime/i18n/ui_schema.py
|
|
54
54
|
oarepo_runtime/i18n/validation.py
|
55
55
|
oarepo_runtime/relations/__init__.py
|
56
56
|
oarepo_runtime/relations/base.py
|
57
|
+
oarepo_runtime/relations/components.py
|
57
58
|
oarepo_runtime/relations/internal.py
|
58
59
|
oarepo_runtime/relations/lookup.py
|
59
60
|
oarepo_runtime/relations/mapping.py
|
60
61
|
oarepo_runtime/relations/pid_relation.py
|
62
|
+
oarepo_runtime/relations/uow.py
|
61
63
|
oarepo_runtime/tasks/__init__.py
|
62
64
|
oarepo_runtime/tasks/datastreams.py
|
63
65
|
oarepo_runtime/ui/__init__.py
|
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
|
{oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/config/permissions_presets.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
|
{oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/readers/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/readers/service.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/writers/__init__.py
RENAMED
File without changes
|
{oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/datastreams/writers/service.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime/expansions/expandable_fields.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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{oarepo-runtime-1.2.20 → oarepo-runtime-1.2.21}/oarepo_runtime.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|