pyPreservica 2.8.1__tar.gz → 2.8.2__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.
- {pypreservica-2.8.1 → pypreservica-2.8.2}/PKG-INFO +1 -1
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica/__init__.py +2 -2
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica/mdformsAPI.py +4 -4
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica.egg-info/PKG-INFO +1 -1
- {pypreservica-2.8.1 → pypreservica-2.8.2}/setup.py +1 -1
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_groups.py +11 -5
- {pypreservica-2.8.1 → pypreservica-2.8.2}/LICENSE.txt +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/README.md +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica/adminAPI.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica/authorityAPI.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica/common.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica/contentAPI.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica/entityAPI.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica/monitorAPI.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica/opex.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica/parAPI.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica/retentionAPI.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica/uploadAPI.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica/webHooksAPI.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica/workflowAPI.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica.egg-info/SOURCES.txt +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica.egg-info/dependency_links.txt +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica.egg-info/requires.txt +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/pyPreservica.egg-info/top_level.txt +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/setup.cfg +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_authority_records.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_bitstream.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_children.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_content_api.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_crawl_fs.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_delete.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_download.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_entity.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_export_opex.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_identifier.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_ingest.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_integrity_check.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_metadata.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_par.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_replace.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_retention.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_schema.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_security.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_thumbnail.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_upload.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_users.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_workflow.py +0 -0
- {pypreservica-2.8.1 → pypreservica-2.8.2}/tests/test_xml_metadata.py +0 -0
|
@@ -18,11 +18,11 @@ from .adminAPI import AdminAPI
|
|
|
18
18
|
from .monitorAPI import MonitorAPI, MonitorCategory, MonitorStatus, MessageStatus
|
|
19
19
|
from .webHooksAPI import WebHooksAPI, TriggerType, WebHookHandler
|
|
20
20
|
from .authorityAPI import AuthorityAPI, Table
|
|
21
|
-
from .mdformsAPI import MetadataGroupsAPI,
|
|
21
|
+
from .mdformsAPI import MetadataGroupsAPI, Group, GroupField, GroupFieldType
|
|
22
22
|
|
|
23
23
|
__author__ = "James Carr (drjamescarr@gmail.com)"
|
|
24
24
|
|
|
25
25
|
# Version of the pyPreservica package
|
|
26
|
-
__version__ = "2.8.
|
|
26
|
+
__version__ = "2.8.2"
|
|
27
27
|
|
|
28
28
|
__license__ = "Apache License Version 2.0"
|
|
@@ -9,13 +9,12 @@ licence: Apache License 2.0
|
|
|
9
9
|
|
|
10
10
|
"""
|
|
11
11
|
import xml.etree.ElementTree
|
|
12
|
-
from enum import StrEnum
|
|
13
12
|
from typing import Callable, List, Union, Generator
|
|
14
13
|
|
|
15
14
|
from pyPreservica.common import *
|
|
16
15
|
|
|
17
16
|
|
|
18
|
-
class GroupFieldType(
|
|
17
|
+
class GroupFieldType(Enum):
|
|
19
18
|
STRING = "STRING"
|
|
20
19
|
LONG_STRING = "LONGSTRING"
|
|
21
20
|
DATE = "DATE"
|
|
@@ -60,11 +59,12 @@ class Group:
|
|
|
60
59
|
name: str
|
|
61
60
|
description: str
|
|
62
61
|
schemaUri: str
|
|
63
|
-
fields: List[GroupField]
|
|
62
|
+
fields: List[GroupField]
|
|
64
63
|
|
|
65
64
|
def __init__(self, name: str, description: str):
|
|
66
65
|
self.name = name
|
|
67
66
|
self.description = description
|
|
67
|
+
self.fields = []
|
|
68
68
|
|
|
69
69
|
def __str__(self):
|
|
70
70
|
return (f"Group ID: {self.group_id}\n" + f"Group Name: {self.name}\n" +
|
|
@@ -114,7 +114,7 @@ def _json_from_object_(group: Group) -> dict:
|
|
|
114
114
|
|
|
115
115
|
fields = []
|
|
116
116
|
for field in group.fields:
|
|
117
|
-
f = {"id": field.field_id, "name": field.name, "type": str(field.field_type)}
|
|
117
|
+
f = {"id": field.field_id, "name": field.name, "type": str(field.field_type.value)}
|
|
118
118
|
f["minOccurs"] = str(field.minOccurs)
|
|
119
119
|
f["maxOccurs"] = str(field.maxOccurs)
|
|
120
120
|
f["visible"] = str(field.visible)
|
|
@@ -21,7 +21,7 @@ if sys.argv[-1] == 'publish':
|
|
|
21
21
|
# This call to setup() does all the work
|
|
22
22
|
setup(
|
|
23
23
|
name=PKG,
|
|
24
|
-
version="2.8.
|
|
24
|
+
version="2.8.2",
|
|
25
25
|
description="Python library for the Preservica API",
|
|
26
26
|
long_description=README,
|
|
27
27
|
long_description_content_type="text/markdown",
|
|
@@ -35,9 +35,9 @@ def test_can_get_group():
|
|
|
35
35
|
def test_can_add_group_by_object():
|
|
36
36
|
client = MetadataGroupsAPI()
|
|
37
37
|
group1: Group = Group("my_group_name1", "my_group_description1")
|
|
38
|
-
group1.fields.append(GroupField(field_id="attribute_1", name="Attribute
|
|
39
|
-
group1.fields.append(GroupField(field_id="attribute_2", name="Attribute
|
|
40
|
-
group1.fields.append(GroupField(field_id="attribute_3", name="Attribute
|
|
38
|
+
group1.fields.append(GroupField(field_id="attribute_1", name="Attribute 1x", field_type=GroupFieldType.STRING))
|
|
39
|
+
group1.fields.append(GroupField(field_id="attribute_2", name="Attribute 2x", field_type=GroupFieldType.NUMBER))
|
|
40
|
+
group1.fields.append(GroupField(field_id="attribute_3", name="Attribute 3x", field_type=GroupFieldType.DATE))
|
|
41
41
|
|
|
42
42
|
g1: dict = client.add_group(group1.name, group1.description, group1.fields)
|
|
43
43
|
|
|
@@ -46,18 +46,24 @@ def test_can_add_group_by_object():
|
|
|
46
46
|
|
|
47
47
|
assert len(g1['fields']) == 3
|
|
48
48
|
|
|
49
|
-
client.
|
|
49
|
+
group1: Group = client.group(g1['id'])
|
|
50
|
+
|
|
51
|
+
client.delete_group(group1.group_id)
|
|
50
52
|
|
|
51
53
|
|
|
52
54
|
def test_can_add_new_fields_to_group():
|
|
53
55
|
client = MetadataGroupsAPI()
|
|
54
56
|
|
|
55
|
-
group2: Group = Group("
|
|
57
|
+
group2: Group = Group("test_group_1", "test_group_1_description")
|
|
58
|
+
|
|
59
|
+
assert len(group2.fields) == 0
|
|
56
60
|
|
|
57
61
|
group2.fields.append(GroupField(field_id="attribute_11", name="Attribute 11", field_type=GroupFieldType.STRING))
|
|
58
62
|
group2.fields.append(GroupField(field_id="attribute_22", name="Attribute 22", field_type=GroupFieldType.NUMBER))
|
|
59
63
|
group2.fields.append(GroupField(field_id="attribute_33", name="Attribute 33", field_type=GroupFieldType.DATE))
|
|
60
64
|
|
|
65
|
+
assert len(group2.fields) == 3
|
|
66
|
+
|
|
61
67
|
g2: dict = client.add_group(group2.name, group2.description, group2.fields)
|
|
62
68
|
|
|
63
69
|
assert g2['name'] == group2.name
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|