oarepo-runtime 1.4.13__tar.gz → 1.4.15__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {oarepo-runtime-1.4.13/oarepo_runtime.egg-info → oarepo-runtime-1.4.15}/PKG-INFO +1 -1
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/cf/__init__.py +1 -1
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/cf/cli.py +0 -1
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/cf/mappings.py +2 -2
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/facets/base.py +3 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/facets/date.py +14 -11
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/i18n/ui_schema.py +2 -8
- oarepo-runtime-1.4.15/oarepo_runtime/records/__init__.py +1 -0
- oarepo-runtime-1.4.15/oarepo_runtime/records/systemfields/__init__.py +10 -0
- {oarepo-runtime-1.4.13/oarepo_runtime/records → oarepo-runtime-1.4.15/oarepo_runtime/records/systemfields}/icu.py +1 -1
- oarepo-runtime-1.4.15/oarepo_runtime/resources/__init__.py +3 -0
- oarepo-runtime-1.4.15/oarepo_runtime/resources/localized_ui_json_serializer.py +41 -0
- oarepo-runtime-1.4.15/oarepo_runtime/services/schema/__init__.py +3 -0
- oarepo-runtime-1.4.15/oarepo_runtime/services/schema/cf.py +13 -0
- oarepo-runtime-1.4.13/oarepo_runtime/ui/marshmallow.py → oarepo-runtime-1.4.15/oarepo_runtime/services/schema/ui.py +41 -18
- oarepo-runtime-1.4.13/oarepo_runtime/services/icu.py → oarepo-runtime-1.4.15/oarepo_runtime/services/search.py +1 -1
- oarepo-runtime-1.4.15/oarepo_runtime/ui/marshmallow.py +9 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15/oarepo_runtime.egg-info}/PKG-INFO +1 -1
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime.egg-info/SOURCES.txt +12 -7
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime.egg-info/entry_points.txt +1 -1
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/setup.cfg +2 -2
- oarepo-runtime-1.4.13/oarepo_runtime/validation/__init__.py +0 -3
- oarepo-runtime-1.4.13/tests/pkg_data/__init__.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/LICENSE +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/MANIFEST.in +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/README.md +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/__init__.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/cli/__init__.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/cli/assets.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/cli/base.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/cli/check.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/cli/index.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/cli/validate.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/config/__init__.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/config/permissions_presets.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/config/service.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/__init__.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/batch.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/catalogue.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/cli.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/config.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/datastreams.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/errors.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/fixtures.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/readers/__init__.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/readers/attachments.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/readers/excel.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/readers/json.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/readers/service.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/readers/yaml.py +0 -0
- /oarepo-runtime-1.4.13/oarepo_runtime/tasks/datastreams.py → /oarepo-runtime-1.4.15/oarepo_runtime/datastreams/tasks.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/transformers.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/utils.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/writers/__init__.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/writers/attachment.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/writers/service.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/writers/validation_errors.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/writers/yaml.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/drafts/__init__.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/drafts/systemfields/__init__.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/drafts/systemfields/has_draftcheck.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/expansions/__init__.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/expansions/expandable_fields.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/expansions/service.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/ext.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/ext_config.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/facets/__init__.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/facets/enum.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/facets/max_facet.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/facets/nested_facet.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/facets/params.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/i18n/__init__.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/i18n/default_translations.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/i18n/dumper.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/i18n/schema.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/i18n/validation.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/marshmallow.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/profile.py +0 -0
- /oarepo-runtime-1.4.13/oarepo_runtime/records/__init__.py → /oarepo-runtime-1.4.15/oarepo_runtime/records/systemfields/mapping.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/relations/__init__.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/relations/base.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/relations/components.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/relations/errors.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/relations/internal.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/relations/lookup.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/relations/mapping.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/relations/pid_relation.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/relations/uow.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/resolvers/__init__.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/resolvers/proxies.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/services/__init__.py +0 -0
- {oarepo-runtime-1.4.13/oarepo_runtime → oarepo-runtime-1.4.15/oarepo_runtime/services/schema}/polymorphic.py +0 -0
- /oarepo-runtime-1.4.13/oarepo_runtime/validation/dates.py → /oarepo-runtime-1.4.15/oarepo_runtime/services/schema/validation.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/translations/cs/LC_MESSAGES/messages.mo +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/translations/cs/LC_MESSAGES/messages.po +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/translations/en/LC_MESSAGES/messages.po +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/translations/messages.pot +0 -0
- {oarepo-runtime-1.4.13/oarepo_runtime/tasks → oarepo-runtime-1.4.15/oarepo_runtime/ui}/__init__.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/uow.py +0 -0
- {oarepo-runtime-1.4.13/oarepo_runtime/ui → oarepo-runtime-1.4.15/oarepo_runtime/utils}/__init__.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/utils/path.py +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime.egg-info/dependency_links.txt +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime.egg-info/requires.txt +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime.egg-info/top_level.txt +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/pyproject.toml +0 -0
- {oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/setup.py +0 -0
- {oarepo-runtime-1.4.13/oarepo_runtime/utils → oarepo-runtime-1.4.15/tests/pkg_data}/__init__.py +0 -0
@@ -4,7 +4,7 @@ from flask import current_app
|
|
4
4
|
from invenio_records.systemfields import DictField, SystemField
|
5
5
|
from invenio_records_resources.services.custom_fields import BaseCF
|
6
6
|
|
7
|
-
from oarepo_runtime.records import MappingSystemFieldMixin
|
7
|
+
from oarepo_runtime.records.systemfields.mapping import MappingSystemFieldMixin
|
8
8
|
|
9
9
|
|
10
10
|
class CustomFieldsMixin(MappingSystemFieldMixin):
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import inspect
|
2
|
-
from typing import Iterable
|
2
|
+
from typing import Iterable
|
3
3
|
|
4
4
|
import click
|
5
5
|
import deepmerge
|
@@ -13,7 +13,7 @@ from invenio_search import current_search_client
|
|
13
13
|
from invenio_search.engine import dsl, search
|
14
14
|
from invenio_search.utils import build_alias_name
|
15
15
|
|
16
|
-
from oarepo_runtime.records import MappingSystemFieldMixin
|
16
|
+
from oarepo_runtime.records.systemfields.mapping import MappingSystemFieldMixin
|
17
17
|
|
18
18
|
|
19
19
|
class Mapping(InvenioMapping):
|
@@ -5,5 +5,8 @@ class LabelledValuesTermsFacet(TermsFacet):
|
|
5
5
|
def __init__(self, *args, **kwargs):
|
6
6
|
super().__init__(*args, **{"value_labels": self.value_labels, **kwargs})
|
7
7
|
|
8
|
+
def localized_value_labels(self, values, locale):
|
9
|
+
return {val: val for val in values}
|
10
|
+
|
8
11
|
def value_labels(self, values):
|
9
12
|
return {val: val for val in values}
|
@@ -3,7 +3,7 @@ import re
|
|
3
3
|
from invenio_records_resources.services.records.facets.facets import LabelledFacetMixin
|
4
4
|
from invenio_search.engine import dsl
|
5
5
|
|
6
|
-
from oarepo_runtime.ui
|
6
|
+
from oarepo_runtime.services.schema.ui import (
|
7
7
|
LocalizedDate,
|
8
8
|
LocalizedDateTime,
|
9
9
|
LocalizedEDTF,
|
@@ -15,24 +15,27 @@ from .base import LabelledValuesTermsFacet
|
|
15
15
|
|
16
16
|
|
17
17
|
class DateFacet(LabelledValuesTermsFacet):
|
18
|
-
def
|
19
|
-
return {val: LocalizedDate().format_value(val) for val in values}
|
18
|
+
def localized_value_labels(self, values, locale):
|
19
|
+
return {val: LocalizedDate(locale=locale).format_value(val) for val in values}
|
20
20
|
|
21
21
|
|
22
22
|
class TimeFacet(LabelledValuesTermsFacet):
|
23
|
-
def
|
24
|
-
return {val: LocalizedTime().format_value(val) for val in values}
|
23
|
+
def localized_value_labels(self, values, locale):
|
24
|
+
return {val: LocalizedTime(locale=locale).format_value(val) for val in values}
|
25
25
|
|
26
26
|
|
27
27
|
class DateTimeFacet(LabelledValuesTermsFacet):
|
28
|
-
def
|
29
|
-
return {
|
28
|
+
def localized_value_labels(self, values, locale):
|
29
|
+
return {
|
30
|
+
val: LocalizedDateTime(locale=locale).format_value(val) for val in values
|
31
|
+
}
|
30
32
|
|
31
33
|
|
32
34
|
class EDTFFacet(LabelledValuesTermsFacet):
|
33
|
-
def
|
35
|
+
def localized_value_labels(self, values, locale):
|
34
36
|
return {
|
35
|
-
val: LocalizedEDTF().format_value(convert_to_edtf(val))
|
37
|
+
val: LocalizedEDTF(locale=locale).format_value(convert_to_edtf(val))
|
38
|
+
for val in values
|
36
39
|
}
|
37
40
|
|
38
41
|
|
@@ -51,9 +54,9 @@ class EDTFIntervalFacet(LabelledFacetMixin, AutoDateHistogramFacet):
|
|
51
54
|
# kwargs["interval"] = "year"
|
52
55
|
super().__init__(*args, **kwargs)
|
53
56
|
|
54
|
-
def
|
57
|
+
def localized_value_labels(self, values, locale):
|
55
58
|
return {
|
56
|
-
val: LocalizedEDTFInterval().format_value(convert_to_edtf(val))
|
59
|
+
val: LocalizedEDTFInterval(locale=locale).format_value(convert_to_edtf(val))
|
57
60
|
for val in values
|
58
61
|
}
|
59
62
|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
from functools import lru_cache
|
2
2
|
|
3
|
-
from flask import current_app
|
4
|
-
from flask_babelex import get_locale
|
5
3
|
from marshmallow import Schema, fields
|
6
4
|
|
7
5
|
|
@@ -40,13 +38,9 @@ def get_i18n_localized_ui_schema(lang_field, value_field):
|
|
40
38
|
def _serialize(self, value, attr=None, obj=None, **kwargs):
|
41
39
|
if not value:
|
42
40
|
return None
|
43
|
-
|
41
|
+
language = self.context["locale"].language
|
44
42
|
for v in value:
|
45
|
-
if
|
46
|
-
return v[value_field]
|
47
|
-
locale = current_app.config["BABEL_DEFAULT_LOCALE"]
|
48
|
-
for v in value:
|
49
|
-
if locale == v[lang_field]:
|
43
|
+
if language == v[lang_field]:
|
50
44
|
return v[value_field]
|
51
45
|
return next(iter(value))[value_field]
|
52
46
|
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -4,7 +4,7 @@ from typing import Dict
|
|
4
4
|
from flask import current_app
|
5
5
|
from invenio_records.systemfields import SystemField
|
6
6
|
|
7
|
-
from oarepo_runtime.records import MappingSystemFieldMixin
|
7
|
+
from oarepo_runtime.records.systemfields.mapping import MappingSystemFieldMixin
|
8
8
|
from oarepo_runtime.relations.lookup import lookup_key
|
9
9
|
|
10
10
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
from flask_babelex import get_locale
|
2
|
+
from flask_resources import MarshmallowSerializer
|
3
|
+
|
4
|
+
|
5
|
+
class LocalizedUIJSONSerializer(MarshmallowSerializer):
|
6
|
+
def __init__(
|
7
|
+
self,
|
8
|
+
format_serializer_cls,
|
9
|
+
object_schema_cls,
|
10
|
+
list_schema_cls=None,
|
11
|
+
schema_context=None,
|
12
|
+
**serializer_options,
|
13
|
+
):
|
14
|
+
super().__init__(
|
15
|
+
format_serializer_cls=format_serializer_cls,
|
16
|
+
object_schema_cls=object_schema_cls,
|
17
|
+
list_schema_cls=list_schema_cls,
|
18
|
+
schema_context=schema_context or {},
|
19
|
+
**serializer_options,
|
20
|
+
)
|
21
|
+
|
22
|
+
def dump_obj(self, obj):
|
23
|
+
"""Dump the object using object schema class."""
|
24
|
+
return self.object_schema_cls(
|
25
|
+
context={**self.schema_context, "locale": get_locale()}
|
26
|
+
).dump(obj)
|
27
|
+
|
28
|
+
def dump_list(self, obj_list):
|
29
|
+
"""Dump the list of objects."""
|
30
|
+
ctx = {
|
31
|
+
"object_schema_cls": self.object_schema_cls,
|
32
|
+
}
|
33
|
+
ctx.update(self.schema_context)
|
34
|
+
ctx["locale"] = get_locale()
|
35
|
+
|
36
|
+
if self.list_schema_cls is None:
|
37
|
+
return self.object_schema_cls(context=self.schema_context).dump(
|
38
|
+
obj_list, many=True
|
39
|
+
)
|
40
|
+
|
41
|
+
return self.list_schema_cls(context=ctx).dump(obj_list)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from invenio_records_resources.services.custom_fields.schema import (
|
2
|
+
CustomFieldsSchemaUI as InvenioCustomFieldsSchemaUI,
|
3
|
+
)
|
4
|
+
|
5
|
+
|
6
|
+
class CustomFieldsSchemaUI(InvenioCustomFieldsSchemaUI):
|
7
|
+
def _serialize(self, obj, **kwargs):
|
8
|
+
self._schema.context.update(self.context)
|
9
|
+
return super()._serialize(obj, **kwargs)
|
10
|
+
|
11
|
+
def _deserialize(self, data, **kwargs):
|
12
|
+
self._schema.context.update(self.context)
|
13
|
+
return super()._deserialize(data, **kwargs)
|
@@ -1,12 +1,11 @@
|
|
1
1
|
import datetime
|
2
2
|
import re
|
3
|
-
from functools import partial
|
4
3
|
|
5
4
|
import marshmallow as ma
|
6
5
|
from babel.dates import format_date
|
7
6
|
from babel_edtf import format_edtf
|
8
7
|
from flask import current_app
|
9
|
-
from flask_babelex import
|
8
|
+
from flask_babelex import gettext
|
10
9
|
from marshmallow_utils.fields import (
|
11
10
|
BabelGettextDictField,
|
12
11
|
FormatDate,
|
@@ -25,8 +24,23 @@ def current_default_locale():
|
|
25
24
|
return "en"
|
26
25
|
|
27
26
|
|
27
|
+
class LocalizedMixin:
|
28
|
+
def __init__(self, *args, locale=None, **kwargs):
|
29
|
+
super().__init__(*args, locale=locale, **kwargs)
|
30
|
+
|
31
|
+
@property
|
32
|
+
def locale(self):
|
33
|
+
if self._locale:
|
34
|
+
return self._locale
|
35
|
+
if self.parent:
|
36
|
+
if "locale" in self.context:
|
37
|
+
return self.context["locale"]
|
38
|
+
return current_default_locale()
|
39
|
+
|
40
|
+
|
28
41
|
# localized date field
|
29
|
-
LocalizedDate
|
42
|
+
class LocalizedDate(LocalizedMixin, FormatDate):
|
43
|
+
pass
|
30
44
|
|
31
45
|
|
32
46
|
class FormatTimeString(FormatTime):
|
@@ -54,18 +68,27 @@ class MultilayerFormatEDTF(BabelFormatField):
|
|
54
68
|
except:
|
55
69
|
return format_edtf(value, format=self._format, locale=self.locale)
|
56
70
|
|
71
|
+
def parse(self, value, **kwargs):
|
72
|
+
# standard parsing is too lenient, for example returns "2000-01-01" for input "2000"
|
73
|
+
if re.match("^[0-9]+-[0-9]+-[0-9]+", value):
|
74
|
+
return super().parse(value, **kwargs)
|
75
|
+
raise ValueError("Not a valid date")
|
76
|
+
|
77
|
+
|
78
|
+
class LocalizedDateTime(LocalizedMixin, FormatDatetime):
|
79
|
+
pass
|
57
80
|
|
58
|
-
# localized edtf
|
59
|
-
LocalizedEDTF = partial(MultilayerFormatEDTF, locale=get_locale)
|
60
81
|
|
61
|
-
|
62
|
-
|
82
|
+
class LocalizedTime(LocalizedMixin, FormatTimeString):
|
83
|
+
pass
|
63
84
|
|
64
|
-
# localized datetime field
|
65
|
-
LocalizedDateTime = partial(FormatDatetime, locale=get_locale)
|
66
85
|
|
67
|
-
|
68
|
-
|
86
|
+
class LocalizedEDTF(LocalizedMixin, MultilayerFormatEDTF):
|
87
|
+
pass
|
88
|
+
|
89
|
+
|
90
|
+
class LocalizedEDTFInterval(LocalizedMixin, FormatEDTF):
|
91
|
+
pass
|
69
92
|
|
70
93
|
|
71
94
|
class PrefixedGettextField(BabelGettextDictField):
|
@@ -79,16 +102,16 @@ class PrefixedGettextField(BabelGettextDictField):
|
|
79
102
|
return gettext(value)
|
80
103
|
|
81
104
|
|
82
|
-
LocalizedEnum
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
105
|
+
class LocalizedEnum(LocalizedMixin, PrefixedGettextField):
|
106
|
+
pass
|
107
|
+
|
108
|
+
def __init__(self, **kwargs):
|
109
|
+
super().__init__(default_locale=current_default_locale, **kwargs)
|
110
|
+
|
88
111
|
|
89
112
|
if False: # NOSONAR
|
90
113
|
# just for the makemessages to pick up the translations
|
91
|
-
translations = [_("True"), _("
|
114
|
+
translations = [_("True"), _("False")]
|
92
115
|
|
93
116
|
|
94
117
|
class InvenioUISchema(ma.Schema):
|
@@ -10,7 +10,7 @@ from invenio_records_resources.services.records import (
|
|
10
10
|
)
|
11
11
|
from invenio_records_resources.services.records.queryparser import SuggestQueryParser
|
12
12
|
|
13
|
-
from oarepo_runtime.records.icu import ICUSuggestField
|
13
|
+
from oarepo_runtime.records.systemfields.icu import ICUSuggestField
|
14
14
|
|
15
15
|
try:
|
16
16
|
from invenio_i18n import get_locale
|
@@ -8,7 +8,6 @@ oarepo_runtime/__init__.py
|
|
8
8
|
oarepo_runtime/ext.py
|
9
9
|
oarepo_runtime/ext_config.py
|
10
10
|
oarepo_runtime/marshmallow.py
|
11
|
-
oarepo_runtime/polymorphic.py
|
12
11
|
oarepo_runtime/profile.py
|
13
12
|
oarepo_runtime/uow.py
|
14
13
|
oarepo_runtime.egg-info/PKG-INFO
|
@@ -37,6 +36,7 @@ oarepo_runtime/datastreams/config.py
|
|
37
36
|
oarepo_runtime/datastreams/datastreams.py
|
38
37
|
oarepo_runtime/datastreams/errors.py
|
39
38
|
oarepo_runtime/datastreams/fixtures.py
|
39
|
+
oarepo_runtime/datastreams/tasks.py
|
40
40
|
oarepo_runtime/datastreams/transformers.py
|
41
41
|
oarepo_runtime/datastreams/utils.py
|
42
42
|
oarepo_runtime/datastreams/readers/__init__.py
|
@@ -70,7 +70,9 @@ oarepo_runtime/i18n/schema.py
|
|
70
70
|
oarepo_runtime/i18n/ui_schema.py
|
71
71
|
oarepo_runtime/i18n/validation.py
|
72
72
|
oarepo_runtime/records/__init__.py
|
73
|
-
oarepo_runtime/records/
|
73
|
+
oarepo_runtime/records/systemfields/__init__.py
|
74
|
+
oarepo_runtime/records/systemfields/icu.py
|
75
|
+
oarepo_runtime/records/systemfields/mapping.py
|
74
76
|
oarepo_runtime/relations/__init__.py
|
75
77
|
oarepo_runtime/relations/base.py
|
76
78
|
oarepo_runtime/relations/components.py
|
@@ -82,10 +84,15 @@ oarepo_runtime/relations/pid_relation.py
|
|
82
84
|
oarepo_runtime/relations/uow.py
|
83
85
|
oarepo_runtime/resolvers/__init__.py
|
84
86
|
oarepo_runtime/resolvers/proxies.py
|
87
|
+
oarepo_runtime/resources/__init__.py
|
88
|
+
oarepo_runtime/resources/localized_ui_json_serializer.py
|
85
89
|
oarepo_runtime/services/__init__.py
|
86
|
-
oarepo_runtime/services/
|
87
|
-
oarepo_runtime/
|
88
|
-
oarepo_runtime/
|
90
|
+
oarepo_runtime/services/search.py
|
91
|
+
oarepo_runtime/services/schema/__init__.py
|
92
|
+
oarepo_runtime/services/schema/cf.py
|
93
|
+
oarepo_runtime/services/schema/polymorphic.py
|
94
|
+
oarepo_runtime/services/schema/ui.py
|
95
|
+
oarepo_runtime/services/schema/validation.py
|
89
96
|
oarepo_runtime/translations/messages.pot
|
90
97
|
oarepo_runtime/translations/cs/LC_MESSAGES/messages.mo
|
91
98
|
oarepo_runtime/translations/cs/LC_MESSAGES/messages.po
|
@@ -94,6 +101,4 @@ oarepo_runtime/ui/__init__.py
|
|
94
101
|
oarepo_runtime/ui/marshmallow.py
|
95
102
|
oarepo_runtime/utils/__init__.py
|
96
103
|
oarepo_runtime/utils/path.py
|
97
|
-
oarepo_runtime/validation/__init__.py
|
98
|
-
oarepo_runtime/validation/dates.py
|
99
104
|
tests/pkg_data/__init__.py
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[metadata]
|
2
2
|
name = oarepo-runtime
|
3
|
-
version = 1.4.
|
3
|
+
version = 1.4.15
|
4
4
|
description = A set of runtime extensions of Invenio repository
|
5
5
|
authors = Alzbeta Pokorna
|
6
6
|
readme = README.md
|
@@ -59,7 +59,7 @@ invenio_base.apps =
|
|
59
59
|
invenio_base.api_apps =
|
60
60
|
oarepo_runtime = oarepo_runtime.ext:OARepoRuntime
|
61
61
|
invenio_celery.tasks =
|
62
|
-
oarepo_runtime_datastreams = oarepo_runtime.tasks
|
62
|
+
oarepo_runtime_datastreams = oarepo_runtime.datastreams.tasks
|
63
63
|
|
64
64
|
[egg_info]
|
65
65
|
tag_build =
|
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.4.13 → oarepo-runtime-1.4.15}/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.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/readers/__init__.py
RENAMED
File without changes
|
{oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/readers/attachments.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/readers/service.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/writers/__init__.py
RENAMED
File without changes
|
{oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/writers/attachment.py
RENAMED
File without changes
|
{oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/datastreams/writers/service.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/drafts/systemfields/__init__.py
RENAMED
File without changes
|
{oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime/drafts/systemfields/has_draftcheck.py
RENAMED
File without changes
|
File without changes
|
{oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/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
|
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.4.13/oarepo_runtime/tasks → oarepo-runtime-1.4.15/oarepo_runtime/ui}/__init__.py
RENAMED
File without changes
|
File without changes
|
{oarepo-runtime-1.4.13/oarepo_runtime/ui → oarepo-runtime-1.4.15/oarepo_runtime/utils}/__init__.py
RENAMED
File without changes
|
File without changes
|
{oarepo-runtime-1.4.13 → oarepo-runtime-1.4.15}/oarepo_runtime.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{oarepo-runtime-1.4.13/oarepo_runtime/utils → oarepo-runtime-1.4.15/tests/pkg_data}/__init__.py
RENAMED
File without changes
|