Skip to content

Commit 06e33fa

Browse files
authored
Do not create empty connections list (#1178)
This should fix (1) from #1139 (comment), by preventing us from sending an empty connections element if the list of connections is empty.
1 parent 47eab0b commit 06e33fa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tableauserverclient/server/request_factory.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ def _generate_xml(self, datasource_item, connection_credentials=None, connection
182182
if connection_credentials is not None and connections is not None:
183183
raise RuntimeError("You cannot set both `connections` and `connection_credentials`")
184184

185-
if connection_credentials is not None:
185+
if connection_credentials is not None and connection_credentials != False:
186186
_add_credentials_element(datasource_element, connection_credentials)
187187

188-
if connections is not None and len(connections) > 0:
188+
if connections is not None and connections != False and len(connections) > 0:
189189
connections_element = ET.SubElement(datasource_element, "connections")
190190
for connection in connections:
191191
_add_connections_element(connections_element, connection)
@@ -337,7 +337,7 @@ def _generate_xml(self, flow_item: "FlowItem", connections: Optional[List["Conne
337337
project_element = ET.SubElement(flow_element, "project")
338338
project_element.attrib["id"] = flow_item.project_id
339339

340-
if connections is not None:
340+
if connections is not None and connections != False:
341341
connections_element = ET.SubElement(flow_element, "connections")
342342
for connection in connections:
343343
_add_connections_element(connections_element, connection)
@@ -904,10 +904,10 @@ def _generate_xml(
904904
if connection_credentials is not None and connections is not None:
905905
raise RuntimeError("You cannot set both `connections` and `connection_credentials`")
906906

907-
if connection_credentials is not None:
907+
if connection_credentials is not None and connection_credentials != False:
908908
_add_credentials_element(workbook_element, connection_credentials)
909909

910-
if connections is not None and len(connections) > 0:
910+
if connections is not None and connections != False and len(connections) > 0:
911911
connections_element = ET.SubElement(workbook_element, "connections")
912912
for connection in connections:
913913
_add_connections_element(connections_element, connection)

0 commit comments

Comments
 (0)