@@ -1,9 +1,10 @@
|
||||
"""SOAP (cargo3) Element serialization and parsing for CSE.
|
||||
|
||||
CSE exposes a SOAP/1C web service ("Карго") that transfers data through nested
|
||||
universal ``Element`` structures (``Key``/``Value``/``ValueType``/``Fields``/
|
||||
``List``/``Tables``/``Properties``). This module builds request envelopes and
|
||||
parses responses into a plain Python representation that mappers can navigate.
|
||||
universal ``Element`` structures (``Key``/``Value``/``ValueType``/
|
||||
``Properties``/``Fields``/``List``/``Tables``). This module builds request
|
||||
envelopes and parses responses into a plain Python representation that mappers
|
||||
can navigate.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -15,8 +16,6 @@ from xml.etree import ElementTree as ET
|
||||
CARGO_NS = "http://www.cargo3.ru"
|
||||
SOAP_NS = "http://www.w3.org/2003/05/soap-envelope"
|
||||
|
||||
# Child tags of an Element that hold nested Element lists.
|
||||
_LIST_TAGS = ("Fields", "List", "Tables", "Properties")
|
||||
_SCALAR_TAGS = ("Key", "Value", "ValueType")
|
||||
_BINARY_TAG = "BData"
|
||||
|
||||
@@ -102,14 +101,14 @@ def _append_element(parent: ET.Element, tag: str, element: Element) -> None:
|
||||
_scalar(node, "Value", element.value)
|
||||
if element.value_type is not None:
|
||||
_scalar(node, "ValueType", element.value_type)
|
||||
for child in element.properties:
|
||||
_append_element(node, "Properties", child)
|
||||
for child in element.fields:
|
||||
_append_element(node, "Fields", child)
|
||||
for child in element.items:
|
||||
_append_element(node, "List", child)
|
||||
for child in element.tables:
|
||||
_append_element(node, "Tables", child)
|
||||
for child in element.properties:
|
||||
_append_element(node, "Properties", child)
|
||||
|
||||
|
||||
def _scalar(parent: ET.Element, tag: str, text: str) -> None:
|
||||
|
||||
Reference in New Issue
Block a user