|
9 | 9 | if TYPE_CHECKING: |
10 | 10 | from tableauserverclient.server import Server |
11 | 11 |
|
12 | | -# this file could be largely replaced if we were willing to import the huge file from generateDS |
13 | | - |
14 | 12 |
|
15 | 13 | def _add_multipart(parts: Dict) -> Tuple[Any, str]: |
16 | 14 | mime_multipart_parts = list() |
@@ -148,28 +146,21 @@ def update_req(self, database_item): |
148 | 146 |
|
149 | 147 |
|
150 | 148 | class DatasourceRequest(object): |
151 | | - def _generate_xml(self, datasource_item: DatasourceItem, connection_credentials=None, connections=None): |
| 149 | + def _generate_xml(self, datasource_item, connection_credentials=None, connections=None): |
152 | 150 | xml_request = ET.Element("tsRequest") |
153 | 151 | datasource_element = ET.SubElement(xml_request, "datasource") |
154 | | - if datasource_item.name: |
155 | | - datasource_element.attrib["name"] = datasource_item.name |
| 152 | + datasource_element.attrib["name"] = datasource_item.name |
156 | 153 | if datasource_item.description: |
157 | 154 | datasource_element.attrib["description"] = str(datasource_item.description) |
158 | 155 | if datasource_item.use_remote_query_agent is not None: |
159 | 156 | datasource_element.attrib["useRemoteQueryAgent"] = str(datasource_item.use_remote_query_agent).lower() |
160 | 157 |
|
161 | 158 | if datasource_item.ask_data_enablement: |
162 | 159 | ask_data_element = ET.SubElement(datasource_element, "askData") |
163 | | - ask_data_element.attrib["enablement"] = datasource_item.ask_data_enablement.__str__() |
164 | | - |
165 | | - if datasource_item.certified: |
166 | | - datasource_element.attrib["isCertified"] = datasource_item.certified.__str__() |
167 | | - if datasource_item.certification_note: |
168 | | - datasource_element.attrib["certificationNote"] = datasource_item.certification_note |
| 160 | + ask_data_element.attrib["enablement"] = datasource_item.ask_data_enablement |
169 | 161 |
|
170 | | - if datasource_item.project_id: |
171 | | - project_element = ET.SubElement(datasource_element, "project") |
172 | | - project_element.attrib["id"] = datasource_item.project_id |
| 162 | + project_element = ET.SubElement(datasource_element, "project") |
| 163 | + project_element.attrib["id"] = datasource_item.project_id |
173 | 164 |
|
174 | 165 | if connection_credentials is not None and connections is not None: |
175 | 166 | raise RuntimeError("You cannot set both `connections` and `connection_credentials`") |
|
0 commit comments