invenio-vocabularies 6.9.0__py2.py3-none-any.whl → 6.10.1__py2.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.
Potentially problematic release.
This version of invenio-vocabularies might be problematic. Click here for more details.
- invenio_vocabularies/__init__.py +1 -1
- invenio_vocabularies/alembic/3ba812d80559_add_internal_name_id.py +36 -0
- invenio_vocabularies/alembic/af2457652217_drop_unique_constraint_from_internal_id.py +37 -0
- invenio_vocabularies/contrib/names/components.py +24 -0
- invenio_vocabularies/contrib/names/config.py +2 -0
- invenio_vocabularies/contrib/names/jsonschemas/names/name-v1.0.0.json +1 -1
- invenio_vocabularies/contrib/names/names.py +3 -1
- invenio_vocabularies/contrib/names/schema.py +2 -1
- invenio_vocabularies/contrib/names/services.py +2 -2
- {invenio_vocabularies-6.9.0.dist-info → invenio_vocabularies-6.10.1.dist-info}/METADATA +9 -1
- {invenio_vocabularies-6.9.0.dist-info → invenio_vocabularies-6.10.1.dist-info}/RECORD +16 -13
- {invenio_vocabularies-6.9.0.dist-info → invenio_vocabularies-6.10.1.dist-info}/AUTHORS.rst +0 -0
- {invenio_vocabularies-6.9.0.dist-info → invenio_vocabularies-6.10.1.dist-info}/LICENSE +0 -0
- {invenio_vocabularies-6.9.0.dist-info → invenio_vocabularies-6.10.1.dist-info}/WHEEL +0 -0
- {invenio_vocabularies-6.9.0.dist-info → invenio_vocabularies-6.10.1.dist-info}/entry_points.txt +0 -0
- {invenio_vocabularies-6.9.0.dist-info → invenio_vocabularies-6.10.1.dist-info}/top_level.txt +0 -0
invenio_vocabularies/__init__.py
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of Invenio.
|
|
3
|
+
# Copyright (C) 2024 CERN.
|
|
4
|
+
#
|
|
5
|
+
# Invenio is free software; you can redistribute it and/or modify it
|
|
6
|
+
# under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
+
|
|
8
|
+
"""Add internal name ID."""
|
|
9
|
+
|
|
10
|
+
import sqlalchemy as sa
|
|
11
|
+
from alembic import op
|
|
12
|
+
from sqlalchemy.dialects import postgresql
|
|
13
|
+
|
|
14
|
+
# revision identifiers, used by Alembic.
|
|
15
|
+
revision = "3ba812d80559"
|
|
16
|
+
down_revision = "55a700f897b6"
|
|
17
|
+
branch_labels = ()
|
|
18
|
+
depends_on = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def upgrade():
|
|
22
|
+
"""Upgrade database."""
|
|
23
|
+
op.add_column(
|
|
24
|
+
"name_metadata", sa.Column("internal_id", sa.String(length=255), nullable=True)
|
|
25
|
+
)
|
|
26
|
+
op.create_unique_constraint(
|
|
27
|
+
op.f("uq_name_metadata_internal_id"), "name_metadata", ["internal_id"]
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def downgrade():
|
|
32
|
+
"""Downgrade database."""
|
|
33
|
+
op.drop_constraint(
|
|
34
|
+
op.f("uq_name_metadata_internal_id"), "name_metadata", type_="unique"
|
|
35
|
+
)
|
|
36
|
+
op.drop_column("name_metadata", "internal_id")
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of Invenio.
|
|
3
|
+
# Copyright (C) 2016-2018 CERN.
|
|
4
|
+
#
|
|
5
|
+
# Invenio is free software; you can redistribute it and/or modify it
|
|
6
|
+
# under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
+
|
|
8
|
+
"""Drop unique constraint from internal id."""
|
|
9
|
+
|
|
10
|
+
import sqlalchemy as sa
|
|
11
|
+
from alembic import op
|
|
12
|
+
from sqlalchemy.dialects import postgresql
|
|
13
|
+
|
|
14
|
+
# revision identifiers, used by Alembic.
|
|
15
|
+
revision = "af2457652217"
|
|
16
|
+
down_revision = "3ba812d80559"
|
|
17
|
+
branch_labels = ()
|
|
18
|
+
depends_on = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def upgrade():
|
|
22
|
+
"""Upgrade database."""
|
|
23
|
+
op.drop_constraint("uq_name_metadata_internal_id", "name_metadata", type_="unique")
|
|
24
|
+
op.create_index(
|
|
25
|
+
op.f("ix_name_metadata_internal_id"),
|
|
26
|
+
"name_metadata",
|
|
27
|
+
["internal_id"],
|
|
28
|
+
unique=False,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def downgrade():
|
|
33
|
+
"""Downgrade database."""
|
|
34
|
+
op.drop_index(op.f("ix_name_metadata_internal_id"), table_name="name_metadata")
|
|
35
|
+
op.create_unique_constraint(
|
|
36
|
+
"uq_name_metadata_internal_id", "name_metadata", ["internal_id"]
|
|
37
|
+
)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of Invenio.
|
|
3
|
+
# Copyright (C) 2024 CERN.
|
|
4
|
+
#
|
|
5
|
+
# Invenio is free software; you can redistribute it and/or modify it
|
|
6
|
+
# under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
+
|
|
8
|
+
"""Names service components."""
|
|
9
|
+
|
|
10
|
+
from invenio_records_resources.services.records.components import ServiceComponent
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class InternalIDComponent(ServiceComponent):
|
|
14
|
+
"""Service component for internal id field."""
|
|
15
|
+
|
|
16
|
+
field = "internal_id"
|
|
17
|
+
|
|
18
|
+
def create(self, identity, data=None, record=None, **kwargs):
|
|
19
|
+
"""Create handler."""
|
|
20
|
+
setattr(record, self.field, data.pop(self.field, None))
|
|
21
|
+
|
|
22
|
+
def update(self, identity, data=None, record=None, **kwargs):
|
|
23
|
+
"""Update handler."""
|
|
24
|
+
setattr(record, self.field, data.pop(self.field, None))
|
|
@@ -21,6 +21,7 @@ from invenio_records_resources.services.records.queryparser import (
|
|
|
21
21
|
from werkzeug.local import LocalProxy
|
|
22
22
|
|
|
23
23
|
from ...services.components import PIDComponent
|
|
24
|
+
from .components import InternalIDComponent
|
|
24
25
|
|
|
25
26
|
names_schemes = LocalProxy(lambda: current_app.config["VOCABULARIES_NAMES_SCHEMES"])
|
|
26
27
|
|
|
@@ -67,6 +68,7 @@ class NamesSearchOptions(SearchOptions):
|
|
|
67
68
|
|
|
68
69
|
service_components = [
|
|
69
70
|
# Order of components are important!
|
|
71
|
+
InternalIDComponent,
|
|
70
72
|
DataComponent,
|
|
71
73
|
PIDComponent,
|
|
72
74
|
RelationsComponent,
|
|
@@ -13,7 +13,7 @@ from invenio_db import db
|
|
|
13
13
|
from invenio_records.dumpers import SearchDumper
|
|
14
14
|
from invenio_records.dumpers.indexedat import IndexedAtDumperExt
|
|
15
15
|
from invenio_records.dumpers.relations import RelationDumperExt
|
|
16
|
-
from invenio_records.systemfields import RelationsField
|
|
16
|
+
from invenio_records.systemfields import ModelField, RelationsField
|
|
17
17
|
from invenio_records_resources.factories.factory import RecordTypeFactory
|
|
18
18
|
from invenio_records_resources.records.systemfields import (
|
|
19
19
|
ModelPIDField,
|
|
@@ -47,10 +47,12 @@ record_type = RecordTypeFactory(
|
|
|
47
47
|
# cannot set to nullable=False because it would fail at
|
|
48
48
|
# service level when create({}), see records-resources.
|
|
49
49
|
"pid": db.Column(db.String(255), unique=True),
|
|
50
|
+
"internal_id": db.Column(db.String(255), nullable=True, index=True),
|
|
50
51
|
},
|
|
51
52
|
schema_version="1.0.0",
|
|
52
53
|
schema_path="local://names/name-v1.0.0.json",
|
|
53
54
|
index_name="names-name-v2.0.0",
|
|
55
|
+
record_cls_attrs={"internal_id": ModelField("internal_id", dump=False)},
|
|
54
56
|
record_relations=name_relations,
|
|
55
57
|
record_dumper=SearchDumper(
|
|
56
58
|
model_fields={"pid": ("id", str)},
|
|
@@ -35,6 +35,7 @@ class NameSchema(BaseVocabularySchema, ModePIDFieldVocabularyMixin):
|
|
|
35
35
|
so it does not inherit from it.
|
|
36
36
|
"""
|
|
37
37
|
|
|
38
|
+
internal_id = fields.Str(allow_none=True)
|
|
38
39
|
name = SanitizedUnicode()
|
|
39
40
|
given_name = SanitizedUnicode()
|
|
40
41
|
family_name = SanitizedUnicode()
|
|
@@ -66,7 +67,7 @@ class NameSchema(BaseVocabularySchema, ModePIDFieldVocabularyMixin):
|
|
|
66
67
|
raise ValidationError({"family_name": messages})
|
|
67
68
|
|
|
68
69
|
@validates_schema
|
|
69
|
-
def
|
|
70
|
+
def validate_affiliations(self, data, **kwargs):
|
|
70
71
|
"""Validate names."""
|
|
71
72
|
affiliations = data.get("affiliations", [])
|
|
72
73
|
seen_names = set()
|
|
@@ -42,10 +42,10 @@ class NamesService(record_type.service_cls):
|
|
|
42
42
|
else:
|
|
43
43
|
results = self._read_many(identity, search_query, max_records=1)
|
|
44
44
|
|
|
45
|
-
# cant use the results_item because it returns dicts
|
|
45
|
+
# cant use the results_item because it returns dicts instead of records
|
|
46
46
|
total = results.hits.total["value"]
|
|
47
47
|
if total == 0:
|
|
48
|
-
# Not a PID but
|
|
48
|
+
# Not a PID but treated as such
|
|
49
49
|
raise PIDDoesNotExistError(pid_type=id_type, pid_value=id_)
|
|
50
50
|
if many:
|
|
51
51
|
for result in results:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: invenio-vocabularies
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.10.1
|
|
4
4
|
Summary: Invenio module for managing vocabularies.
|
|
5
5
|
Home-page: https://github.com/inveniosoftware/invenio-vocabularies
|
|
6
6
|
Author: CERN
|
|
@@ -88,6 +88,14 @@ https://invenio-vocabularies.readthedocs.io/
|
|
|
88
88
|
Changes
|
|
89
89
|
=======
|
|
90
90
|
|
|
91
|
+
Version v6.10.1 (released 2024-12-12)
|
|
92
|
+
|
|
93
|
+
- names: drop unique id on the internal id
|
|
94
|
+
|
|
95
|
+
Version v6.10.0 (released 2024-12-12)
|
|
96
|
+
|
|
97
|
+
- names: add internal id column to the name_metadata db
|
|
98
|
+
|
|
91
99
|
Version v6.9.0 (released 2024-12-09)
|
|
92
100
|
|
|
93
101
|
- schema: added identifiers in affiliations relation
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
invenio_vocabularies/__init__.py,sha256=
|
|
1
|
+
invenio_vocabularies/__init__.py,sha256=AuxBwriF5RZLYPa0nMk9hQ6Ce1qQsJl1URBZCd-64LE,378
|
|
2
2
|
invenio_vocabularies/cli.py,sha256=CpXTTIn2GTpUqNfLEMlRAp3JWst8ZjHVxoGYdhuuv_4,5959
|
|
3
3
|
invenio_vocabularies/config.py,sha256=h9Iied753mmZwZZHe5COMqUYvV-zSQtx763EIkUVb1Q,6973
|
|
4
4
|
invenio_vocabularies/ext.py,sha256=GujJ4UARd4Fxf4z7zznRk9JAgHamZuYCOdrKU5czg00,5987
|
|
@@ -12,6 +12,7 @@ invenio_vocabularies/administration/__init__.py,sha256=0bDp2Aw8aZth7C-q9Xn9rxeCU
|
|
|
12
12
|
invenio_vocabularies/administration/views/__init__.py,sha256=31DP4jLG6q4HQlzSRiGLPxUjHPUCCl4N34y4XMuPP6g,313
|
|
13
13
|
invenio_vocabularies/administration/views/vocabularies.py,sha256=JyKr1OYF9DO89zvWCNOtNfClO_QptdHdjvgY1kkImnw,1290
|
|
14
14
|
invenio_vocabularies/alembic/17c703ce1eb7_create_names_table.py,sha256=2QGs0Ofi6yd93VzIBqghNi47hrZtuLf0DylKyvVzskI,1572
|
|
15
|
+
invenio_vocabularies/alembic/3ba812d80559_add_internal_name_id.py,sha256=dwurTL2HN2GQK3c62o6xGugJqgn30DZlhq_njyUBa7s,945
|
|
15
16
|
invenio_vocabularies/alembic/4a9a4fd235f8_create_vocabulary_schemes.py,sha256=Ywtp8qOFcI3PxUXemHdvy_VwdcUVtMFV1sFgNAmYrms,1054
|
|
16
17
|
invenio_vocabularies/alembic/4f365fced43f_create_vocabularies_tables.py,sha256=jSrr0CLRchYADjkFeod0L-oophq2woXtRwbUU5Vytiw,3039
|
|
17
18
|
invenio_vocabularies/alembic/55a700f897b6_add_names_and_afiliations_pid_column.py,sha256=w1mmkT7fpTeQJ--YmkIqkwtx7DmaP5cXpKPCJr_0Jko,2381
|
|
@@ -19,6 +20,7 @@ invenio_vocabularies/alembic/6312f33645c1_create_affiliations_table.py,sha256=0r
|
|
|
19
20
|
invenio_vocabularies/alembic/676dd587542d_create_funders_vocabulary_table.py,sha256=4y0jihIQ1s93k7EoqC4vZFrR-tXvuxa678u9hKcu0z0,1791
|
|
20
21
|
invenio_vocabularies/alembic/8ff82dfb0be8_create_vocabularies_branch.py,sha256=RnyKQ38Pkubf_DU2rH9pRdufoAvABdnaP9b9S4-y4Vw,586
|
|
21
22
|
invenio_vocabularies/alembic/__init__.py,sha256=zTkqaw55uK5Bj6VgisfzONfDTxpP6Ty_wMroptywf8U,244
|
|
23
|
+
invenio_vocabularies/alembic/af2457652217_drop_unique_constraint_from_internal_id.py,sha256=tm-idMf72GqY2Bq8LUWEdeZSnPmSIVVh5_NeTYkDfkI,1008
|
|
22
24
|
invenio_vocabularies/alembic/e1146238edd3_create_awards_table.py,sha256=XDAON1kbjAZr3H9neB7YufFVr4lRXmr6mMARRLlURfs,1705
|
|
23
25
|
invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/.eslintrc.yml,sha256=aERX8bU_YWne3S8Ai0FlI705MwJ1AXNb-V9W6FsAc6I,338
|
|
24
26
|
invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/.prettierrc,sha256=67zvnPdNPnqAfVYrzQJZAVa2T-lyfzJnwrDu5lo10jQ,59
|
|
@@ -112,17 +114,18 @@ invenio_vocabularies/contrib/funders/mappings/v7/__init__.py,sha256=yFHmi3QYD65Y
|
|
|
112
114
|
invenio_vocabularies/contrib/funders/mappings/v7/funders/funder-v1.0.0.json,sha256=E7Zp4IHsQGdaxVrksr-SaQtieV7tV0W6-LgGe231G1w,1646
|
|
113
115
|
invenio_vocabularies/contrib/names/__init__.py,sha256=DBfsM7JMETZGaV5QmXEwE7zhCaAXvc2SZN6uXnW_V-c,451
|
|
114
116
|
invenio_vocabularies/contrib/names/api.py,sha256=sEPn_jFX3gyoxgbdEUSIvOoPCUI8pocI6qCZO6mzCgQ,300
|
|
115
|
-
invenio_vocabularies/contrib/names/
|
|
117
|
+
invenio_vocabularies/contrib/names/components.py,sha256=PyYD1lOhmsuNoyDwM_huxkeo7kWd44vkEbJk9gqbDrM,769
|
|
118
|
+
invenio_vocabularies/contrib/names/config.py,sha256=62jh4MP-CygnBpnRBVaCoGySHDEwhBSG1MnlUBumthw,2046
|
|
116
119
|
invenio_vocabularies/contrib/names/datastreams.py,sha256=mmhtdrda6b4c83dRjxVF5JTqtkt92GSEMHTU6TzQtHw,14570
|
|
117
120
|
invenio_vocabularies/contrib/names/models.py,sha256=SYdtDDG-y5Wq_d06YhiVO5n8gfxPW_mx-tECsIcv5H8,308
|
|
118
|
-
invenio_vocabularies/contrib/names/names.py,sha256=
|
|
121
|
+
invenio_vocabularies/contrib/names/names.py,sha256=jej3gkBgOJpKwp5RmWk1AP678WkMb0VqCpzbTHLTyEc,2675
|
|
119
122
|
invenio_vocabularies/contrib/names/permissions.py,sha256=5xrpYsA3oQUJ5lJpF7wjRAFiW-pM6_yP1k9zllbRwnQ,844
|
|
120
123
|
invenio_vocabularies/contrib/names/resources.py,sha256=Z8XqLKfFKE69zdTTvcTDmpEZ6wqiqjIH5tp0LzXTSwQ,1588
|
|
121
124
|
invenio_vocabularies/contrib/names/s3client.py,sha256=c7B9_NbnXCfE4pE_yMTsT6uQ2hgbcRU-KY6nbWFuFzU,1063
|
|
122
|
-
invenio_vocabularies/contrib/names/schema.py,sha256=
|
|
123
|
-
invenio_vocabularies/contrib/names/services.py,sha256=
|
|
125
|
+
invenio_vocabularies/contrib/names/schema.py,sha256=TmMel-JswqArUpwmGKFahNFJTx5yqVy_osAxWEgAThY,3665
|
|
126
|
+
invenio_vocabularies/contrib/names/services.py,sha256=ntcGUTM0ZsKnRTxIKvZhKrRuup6Tjv965PATCaJR6Cc,2127
|
|
124
127
|
invenio_vocabularies/contrib/names/jsonschemas/__init__.py,sha256=pdDZdyoxqWbAQ6ngiclhYoDUsGKgRDRPXlIDy0U5Jzg,241
|
|
125
|
-
invenio_vocabularies/contrib/names/jsonschemas/names/name-v1.0.0.json,sha256=
|
|
128
|
+
invenio_vocabularies/contrib/names/jsonschemas/names/name-v1.0.0.json,sha256=WlIroNhE9o6oh1Cd13ymBPXuXDOs0NYfjLGtAH417YI,1574
|
|
126
129
|
invenio_vocabularies/contrib/names/mappings/__init__.py,sha256=l5hYJmrj83lds5GupnwCcwQn7cdJo6_4H4YYzrnBa54,242
|
|
127
130
|
invenio_vocabularies/contrib/names/mappings/os-v1/__init__.py,sha256=CKtF-xflE4QGF5P82Lj1ifEP1c7ekR24fc3SiTAkhsY,249
|
|
128
131
|
invenio_vocabularies/contrib/names/mappings/os-v1/names/name-v1.0.0.json,sha256=5Ybcq3fUMYx3u1MNKmHh-CWBtATS9MYpdEcwAM8EQ80,1943
|
|
@@ -302,10 +305,10 @@ invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.mo,sha256=g1I5aNO8r
|
|
|
302
305
|
invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.po,sha256=vg8qC8ofpAdJ3mQz7mWM1ylKDpiNWXFs7rlMdSPkgKk,4629
|
|
303
306
|
invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.mo,sha256=cqSm8NtMAwrP9O6qbmtkDtRT1e9D93qpsJN5X9_PPVw,600
|
|
304
307
|
invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.po,sha256=9ACePz_EpB-LfcIJajZ2kp8Q04tcdrQLOtug162ZUss,4115
|
|
305
|
-
invenio_vocabularies-6.
|
|
306
|
-
invenio_vocabularies-6.
|
|
307
|
-
invenio_vocabularies-6.
|
|
308
|
-
invenio_vocabularies-6.
|
|
309
|
-
invenio_vocabularies-6.
|
|
310
|
-
invenio_vocabularies-6.
|
|
311
|
-
invenio_vocabularies-6.
|
|
308
|
+
invenio_vocabularies-6.10.1.dist-info/AUTHORS.rst,sha256=8d0p_WWE1r9DavvzMDi2D4YIGBHiMYcN3LYxqQOj8sY,291
|
|
309
|
+
invenio_vocabularies-6.10.1.dist-info/LICENSE,sha256=UvI8pR8jGWqe0sTkb_hRG6eIrozzWwWzyCGEpuXX4KE,1062
|
|
310
|
+
invenio_vocabularies-6.10.1.dist-info/METADATA,sha256=emO6pmwnGPoiYE0Gy3Te3obKC18h85uaQ2-r4yvSfMA,12483
|
|
311
|
+
invenio_vocabularies-6.10.1.dist-info/WHEEL,sha256=-G_t0oGuE7UD0DrSpVZnq1hHMBV9DD2XkS5v7XpmTnk,110
|
|
312
|
+
invenio_vocabularies-6.10.1.dist-info/entry_points.txt,sha256=ud9nfdMlhO_mu3okwmy5vQD48r3-rCU_pSR-lUtLeYE,3180
|
|
313
|
+
invenio_vocabularies-6.10.1.dist-info/top_level.txt,sha256=x1gRNbaODF_bCD0SBLM3nVOFPGi06cmGX5X94WKrFKk,21
|
|
314
|
+
invenio_vocabularies-6.10.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{invenio_vocabularies-6.9.0.dist-info → invenio_vocabularies-6.10.1.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{invenio_vocabularies-6.9.0.dist-info → invenio_vocabularies-6.10.1.dist-info}/top_level.txt
RENAMED
|
File without changes
|