8000 Workbook update Description (#1516) · tableau/server-client-python@3460528 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3460528

Browse files
authored
Workbook update Description (#1516)
* Allows workbook updates to change the description starting with api version 3.21 * Fixes formatting * Fixes style issues caused by using black and python version 3.13
1 parent c3ea910 commit 3460528

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tableauserverclient/server/endpoint/workbooks_endpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def update(
280280
if include_view_acceleration_status:
281281
url += "?includeViewAccelerationStatus=True"
282282

283-
update_req = RequestFactory.Workbook.update_req(workbook_item)
283+
update_req = RequestFactory.Workbook.update_req(workbook_item, self.parent_srv)
284284
server_response = self.put_request(url, update_req)
285285
logger.info(f"Updated workbook item (ID: {workbook_item.id})")
286286
updated_workbook = copy.copy(workbook_item)

tableauserverclient/server/request_factory.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ def _generate_xml(
960960
_add_hiddenview_element(views_element, view_name)
961961
return ET.tostring(xml_request)
962962

963-
def update_req(self, workbook_item):
963+
def update_req(self, workbook_item, parent_srv: Optional["Server"] = None):
964964
xml_request = ET.Element("tsRequest")
965965
workbook_element = ET.SubElement(xml_request, "workbook")
966966
if workbook_item.name:
@@ -973,6 +973,12 @@ def update_req(self, workbook_item):
973973
if workbook_item.owner_id:
974974
owner_element = ET.SubElement(workbook_element, "owner")
975975
owner_element.attrib["id"] = workbook_item.owner_id
976+
if (
977+
workbook_item.description is not None
978+
and parent_srv is not None
979+
and parent_srv.check_at_least_version("3.21")
980+
):
981+
workbook_element.attrib["description"] = workbook_item.description
976982
if workbook_item._views is not None:
977983
views_element = ET.SubElement(workbook_element, "views")
978984
for view in workbook_item.views:

0 commit comments

Comments
 (0)
0