Skip to content

Commit 41acc15

Browse files
committed
[section] Add prop cardinality on init
1 parent 14ce405 commit 41acc15

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

odml/section.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ class BaseSection(base.Sectionable):
4040
:param link: Specifies a soft link, i.e. a path within the document.
4141
:param include: Specifies an arbitrary URL. Can only be used if *link* is not set.
4242
:param oid: object id, UUID string as specified in RFC 4122. If no id is provided,
43-
an id will be generated and assigned. An id has to be unique
44-
within an odML Document.
43+
an id will be generated and assigned. An id has to be unique
44+
within an odML Document.
45+
:param prop_cardinality: Property cardinality defines how many Properties are allowed for this
46+
Section. By default unlimited Properties can be set.
47+
A required number of Properties can be set by assigning a tuple of the
48+
format "(min, max)".
4549
"""
4650

4751
type = None
@@ -54,7 +58,8 @@ class BaseSection(base.Sectionable):
5458

5559
def __init__(self, name=None, type="n.s.", parent=None,
5660
definition=None, reference=None,
57-
repository=None, link=None, include=None, oid=None):
61+
repository=None, link=None, include=None, oid=None,
62+
prop_cardinality=None):
5863

5964
# Sets _sections Smartlist and _repository to None, so run first.
6065
super(BaseSection, self).__init__()
@@ -80,6 +85,7 @@ def __init__(self, name=None, type="n.s.", parent=None,
8085
self._repository = repository
8186
self._link = link
8287
self._include = include
88+
self._prop_cardinality = prop_cardinality
8389

8490
# this may fire a change event, so have the section setup then
8591
self.type = type

0 commit comments

Comments
 (0)