Add psm writer
This commit is contained in:
+4
-4
@@ -13,7 +13,7 @@ def write_xml_data(root: ET.Element, file_path: Path, pretty: bool = True) -> No
|
||||
xml_str = ET.tostring(root, encoding="utf-8", xml_declaration=True, pretty_print=pretty)
|
||||
file_path.write_bytes(xml_str)
|
||||
|
||||
def _sanitize_name(name: str) -> str:
|
||||
def sanitize_name(name: str) -> str:
|
||||
"""
|
||||
Sanitize a name by removing all non-letter characters except hyphens and Scandinavian letters.
|
||||
"""
|
||||
@@ -61,10 +61,10 @@ def add_connection(root: ET.Element, name: str, attr_list: list[str], descriptio
|
||||
ET.SubElement(mapping, "Map", ToCommand=f"Get-CodeServerPages{name}", Parameter="conceptCodeId")
|
||||
|
||||
for attr in attr_list:
|
||||
property = ET.SubElement(properties, "Property", Name=_sanitize_name(attr), DataType="String", IsMultivalue="false", IsAutoFill="false")
|
||||
property = ET.SubElement(properties, "Property", Name=sanitize_name(attr), DataType="String", IsMultivalue="false", IsAutoFill="false")
|
||||
return_binding = ET.SubElement(property, "ReturnBinding")
|
||||
ET.SubElement(return_binding, "Bind", CommandResultOf=f"Get-AllCodeServerPages{name}", Path=_sanitize_name(attr))
|
||||
ET.SubElement(return_binding, "Bind", CommandResultOf=f"Get-CodeServerPage{name}", Path=_sanitize_name(attr))
|
||||
ET.SubElement(return_binding, "Bind", CommandResultOf=f"Get-AllCodeServerPages{name}", Path=sanitize_name(attr))
|
||||
ET.SubElement(return_binding, "Bind", CommandResultOf=f"Get-CodeServerPage{name}", Path=sanitize_name(attr))
|
||||
|
||||
read_configuration = ET.SubElement(new_class, "ReadConfiguration")
|
||||
listing_command = ET.SubElement(read_configuration, "ListingCommand", Command=f"Get-AllCodeServerPages{name}")
|
||||
|
||||
Reference in New Issue
Block a user