Commit bda8ba1c authored by Scheffers, E.T.J.'s avatar Scheffers, E.T.J.

Merge branch '16-add-properties-to-product-bundles' into 'master'

Resolve "Add properties to product bundles"

Closes #16

See merge request momotor/engine-py3/momotor-bundles!6
parents f38fac7d 9120a382
......@@ -54,7 +54,7 @@ It provides a Python interface to read and create XML files of
It also implements all methods inherited from :class:`~momotor.bundles.Bundle`
.. autoclass:: momotor.bundles.ProductBundle
:members: create, id, options, get_options, get_option_value, files, copy_files
:members: create, id, options, get_options, get_option_value, files, copy_files, get_properties, get_property_value
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -10,11 +10,12 @@ from momotor.bundles.const import BundleCategory
from momotor.bundles.elements.base import IdMixin
from momotor.bundles.elements.files import File, FilesMixin
from momotor.bundles.elements.options import Option, OptionsMixin
from import Property, PropertiesMixin
__all__ = ['ProductBundle']
class ProductBundle(Bundle, IdMixin, OptionsMixin, FilesMixin):
class ProductBundle(Bundle, IdMixin, OptionsMixin, FilesMixin, PropertiesMixin):
""" A product bundle. This implements the interface to create and access Momotor product files
def __init__(self, base: typing.Union[str, pathlib.Path] = None, zip_file: zipfile.ZipFile = None):
......@@ -22,12 +23,14 @@ class ProductBundle(Bundle, IdMixin, OptionsMixin, FilesMixin):
# noinspection PyShadowingBuiltins
def create(self, *,
id: str = None,
options: typing.List[Option] = None,
files: typing.List[File] = None) -> "ProductBundle":
files: typing.List[File] = None,
properties: typing.List[Property] = None) -> "ProductBundle":
""" Set all attributes for this ProductBundle
......@@ -39,12 +42,14 @@ class ProductBundle(Bundle, IdMixin, OptionsMixin, FilesMixin):
:param id: `id` of the bundle (optional)
:param options: list of options (optional)
:param files: list of files (optional)
:param properties: list of properties (optional)
:return: self
# TODO meta = id
self.options = options
self.files = files = properties
return self
def recreate(self, target_bundle: "momotor.bundles.Bundle", target_basesrc: PurePosixPath = None) \
......@@ -59,7 +64,8 @@ class ProductBundle(Bundle, IdMixin, OptionsMixin, FilesMixin):
return self.create(,
options=self._collect_options(node, []),
files=self._collect_files(node, [])
files=self._collect_files(node, []),
def _construct_node(self) -> productComplexType:
......@@ -67,6 +73,7 @@ class ProductBundle(Bundle, IdMixin, OptionsMixin, FilesMixin):,
......@@ -185,6 +185,7 @@
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="meta" type="metaComplexType"/>
<xs:element name="options" type="optionsComplexType"/>
<xs:element name="properties" type="propertiesComplexType"/>
<xs:element name="files" type="filesComplexType"/>
<xs:attribute use="optional" name="id" type="xs:ID"/>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment