Skip to content

Commit

Permalink
Module.py improve updateform
Browse files Browse the repository at this point in the history
  • Loading branch information
mokko committed Sep 28, 2024
1 parent 196e66c commit 745301b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/mpapi/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ def dataField(
)[0]
except Exception:
if dataType is None:
# print (f"{name=}")
typeHint = name[-3:]
dataType = dataTypes[typeHint]
if value is None:
Expand All @@ -389,6 +390,25 @@ def dataField(
valueN.text = value
return dataFieldN

def systemField(self, *, parent: ET, name: str, dataType: str, value: str):
"""
I dont seem to change a systemField with an updateField endpoint.
<systemField dataType="{dataType}" name="{name}">
<value>{value}</value>
</systemField>
"""
systemFieldN = etree.SubElement(
parent, "{http://www.zetcom.com/ria/ws/module}systemField", name=name
)
# dataType=dataType,

valueN = etree.SubElement(
systemFieldN, "{http://www.zetcom.com/ria/ws/module}value"
)
valueN.text = value

return systemFieldN

def delItem(self, *, modItemId: int, mtype: str):
itemN = self.xpath(
"""/m:application/m:modules/m:module[
Expand Down Expand Up @@ -859,6 +879,7 @@ def uploadForm(self) -> None:
# self._dropAttribs(xpath="//m:moduleReference", attrib="targetModule")
# self._dropAttribs(xpath="//m:moduleReference", attrib="multiplicity")
# self._dropAttribs(xpath="//m:moduleReference", attrib="size")
self._dropAttribs(xpath="//m:moduleReferenceItem", attrib="uuid")
self._dropAttribs(xpath="//m:vocabularyReference", attrib="id")
self._dropAttribs(xpath="//m:vocabularyReference", attrib="instanceName")
self._dropAttribs(xpath="//m:vocabularyReferenceItem", attrib="name")
Expand Down

0 comments on commit 745301b

Please sign in to comment.