Skip to content

Commit

Permalink
chore: make content optional for forename, title and formatted_initials
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanomunarini committed Nov 13, 2023
1 parent c2ab40f commit 76964a4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
4 changes: 4 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Changelog
=========

v0.2.28
=======

- Make `content` optional for forename, formatted_initials and title

v0.2.27
=======
Expand Down
2 changes: 1 addition & 1 deletion relaton/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.2.27'
__version__ = '0.2.28'
7 changes: 3 additions & 4 deletions relaton/models/people.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@

from .contacts import ContactMethod
from .orgs import Organization
from .strings import GenericStringValue
from .strings import GenericStringValue, GenericStringValueWithOptionalContent

__all__ = ('Forename', 'Person', 'FullName', 'GivenName', 'PersonAffiliation', )


@dataclass
class Forename(GenericStringValue):
class Forename(GenericStringValueWithOptionalContent):
"""A forename of a person"""

content: Optional[str] = None
initial: Optional[str] = None
"""
An individual initial of the person, corresponding to the given forename.
Expand All @@ -33,7 +32,7 @@ class GivenName:
]] = None
"""Also known as given name or first name."""

formatted_initials: Optional[GenericStringValue] = None
formatted_initials: Optional[GenericStringValueWithOptionalContent] = None
"""The initials of the person, as a formatted string, including punctuation, dropping
punctuation as desired, and including hyphens where necessary. For example,
the initial set for Jean-Paul would be J, P; the formatted initials would be "J.-P."
Expand Down
14 changes: 13 additions & 1 deletion relaton/models/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,19 @@ class GenericStringValue(FormattedContent):


@dataclass
class Title(GenericStringValue):
class GenericStringValueWithOptionalContent:
"""
Roughly corresponds to a combination
of Relaton’s localized & formatted string.
"""
content: Optional[str] = None
format: Optional[str] = None
script: Optional[Union[str, List[str]]] = None
language: Optional[Union[str, List[str]]] = None


@dataclass
class Title(GenericStringValueWithOptionalContent):
"""
Typed title.
"""
Expand Down

0 comments on commit 76964a4

Please sign in to comment.