Skip to content

Configuration options

Permissions

Bases: Enum

Options of permissions for resources and values:

  • PROJECT_SPECIFIC_PERMISSIONS: the permissions defined on project level will be applied
  • OPEN: the resource/value is visible for everyone
  • RESTRICTED: the resource/value is only visible for project members
  • RESTRICTED_VIEW: the resource/value is visible for everyone, but images are blurred/watermarked for non-project members

Examples:

resource = xmllib.Resource.create_new(
    res_id="ID",
    restype=":ResourceType",
    label="label",
    permissions=xmllib.Permissions.RESTRICTED,
)
Source code in dsp/dsp-tools/src/dsp_tools/xmllib/models/config_options.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class Permissions(Enum):
    """
    Options of permissions for resources and values:

    - `PROJECT_SPECIFIC_PERMISSIONS`: the permissions defined on project level will be applied
    - `OPEN`: the resource/value is visible for everyone
    - `RESTRICTED`: the resource/value is only visible for project members
    - `RESTRICTED_VIEW`: the resource/value is visible for everyone,
      but images are blurred/watermarked for non-project members

    Examples:
        ```python
        resource = xmllib.Resource.create_new(
            res_id="ID",
            restype=":ResourceType",
            label="label",
            permissions=xmllib.Permissions.RESTRICTED,
        )
        ```
    """

    PROJECT_SPECIFIC_PERMISSIONS = ""
    OPEN = "open"
    RESTRICTED = "restricted"
    RESTRICTED_VIEW = "restricted-view"

NewlineReplacement

Bases: Enum

Options how to deal with \n inside rich text values.

  • NONE: don't modify the rich text (\n will be lost, because it is meaningless in an XML file)
  • PARAGRAPH: replace Start\nEnd with <p>Start</p><p>End</p>
  • LINEBREAK: replace Start\nEnd with Start<br/>End

Examples:

# setting the replacement options for newlines
resource = resource.add_richtext(
    prop_name=":propName",
    value="Start\n\nEnd",
    newline_replacement=xmllib.NewlineReplacement.PARAGRAPH
)
Source code in dsp/dsp-tools/src/dsp_tools/xmllib/models/config_options.py
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
class NewlineReplacement(Enum):
    """
    Options how to deal with `\\n` inside rich text values.

    - `NONE`: don't modify the rich text (`\\n` will be lost, because it is meaningless in an XML file)
    - `PARAGRAPH`: replace `Start\\nEnd` with `<p>Start</p><p>End</p>`
    - `LINEBREAK`: replace `Start\\nEnd` with `Start<br/>End`

    Examples:
        ```python
        # setting the replacement options for newlines
        resource = resource.add_richtext(
            prop_name=":propName",
            value="Start\\n\\nEnd",
            newline_replacement=xmllib.NewlineReplacement.PARAGRAPH
        )
        ```
    """

    NONE = auto()
    PARAGRAPH = auto()
    LINEBREAK = auto()

DateFormat

Bases: Enum

Date format options for the reformat_date function.

  • YYYY_MM_DD
  • DD_MM_YYYY
  • MM_DD_YYYY
Source code in dsp/dsp-tools/src/dsp_tools/xmllib/models/config_options.py
58
59
60
61
62
63
64
65
66
67
68
69
class DateFormat(Enum):
    """
    Date format options for the [`reformat_date`](https://docs.dasch.swiss/latest/DSP-TOOLS/xmllib-api-reference/helpers/#xmllib.helpers.reformat_date) function.

    - `YYYY_MM_DD`
    - `DD_MM_YYYY`
    - `MM_DD_YYYY`
    """  # noqa: E501

    YYYY_MM_DD = auto()
    DD_MM_YYYY = auto()
    MM_DD_YYYY = auto()

Calendar

Bases: Enum

Calendar options for the reformat_date function.

  • GREGORIAN
  • JULIAN
  • ISLAMIC
Source code in dsp/dsp-tools/src/dsp_tools/xmllib/models/config_options.py
72
73
74
75
76
77
78
79
80
81
82
83
class Calendar(Enum):
    """
    Calendar options for the [`reformat_date`](https://docs.dasch.swiss/latest/DSP-TOOLS/xmllib-api-reference/helpers/#xmllib.helpers.reformat_date) function.

    - `GREGORIAN`
    - `JULIAN`
    - `ISLAMIC`
    """  # noqa: E501

    GREGORIAN = "GREGORIAN"
    JULIAN = "JULIAN"
    ISLAMIC = "ISLAMIC"

Era

Bases: Enum

Era options for the reformat_date function.

  • CE
  • BCE
  • AD
  • BC
Source code in dsp/dsp-tools/src/dsp_tools/xmllib/models/config_options.py
86
87
88
89
90
91
92
93
94
95
96
97
98
99
class Era(Enum):
    """
    Era options for the [`reformat_date`](https://docs.dasch.swiss/latest/DSP-TOOLS/xmllib-api-reference/helpers/#xmllib.helpers.reformat_date) function.

    - `CE`
    - `BCE`
    - `AD`
    - `BC`
    """  # noqa: E501

    CE = "CE"
    BCE = "BCE"
    AD = "AD"
    BC = "BC"