8000 Add site option for attribute-capture · mirror-dump/server-client-python@5d466f9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5d466f9

Browse files
committed
Add site option for attribute-capture
(Lee's code)
1 parent eaedc29 commit 5d466f9

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

tableauserverclient/models/site_item.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ class SiteItem(object):
2626
_tier_explorer_capacity: Optional[int] = None
2727
_tier_viewer_capacity: Optional[int] = None
2828

29-
def __str__(self):
29+
# TODO should have a debug representation that just lists all the attributes?
30+
def __repr__(self):
3031
return (
3132
"<"
3233
+ __name__
@@ -98,6 +99,7 @@ def __init__(
9899
time_zone=None,
99100
auto_suspend_refresh_enabled: bool = True,
100101
auto_suspend_refresh_inactivity_window: int = 30,
102+
attribute_capture_enabled: bool = True,
101103
):
102104
self._admin_mode = None
103105
self._id: Optional[str] = None
@@ -151,6 +153,7 @@ def __init__(
151153
self.time_zone = time_zone
152154
self.auto_suspend_refresh_enabled = auto_suspend_refresh_enabled
153155
self.auto_suspend_refresh_inactivity_window = auto_suspend_refresh_inactivity_window
156+
self.attribute_capture_enabled = attribute_capture_enabled
154157

155158
@property
156159
def admin_mode(self) -> Optional[str]:
@@ -592,6 +595,14 @@ def auto_suspend_refresh_enabled(self) -> bool:
592595
def auto_suspend_refresh_enabled(self, value: bool):
593596
self._auto_suspend_refresh_enabled = value
594597

598+
@property
599+
def attribute_capture_enabled(self) -> bool:
600+
return self._attribute_capture_enabled
601+
602+
@attribute_capture_enabled.setter
603+
def attribute_capture_enabled(self, value: bool):
604+
self._attribute_capture_enabled = value
605+
595606
def replace_license_tiers_with_user_quota(self, value: int) -> None:
596607
self.tier_creator_capacity = None
597608
self.tier_explorer_capacity = None
@@ -654,6 +665,7 @@ def _parse_common_tags(self, site_xml, ns):
654665
time_zone,
655666
auto_suspend_refresh_enabled,
656667
auto_suspend_refresh_inactivity_window,
668+
attribute_capture_enabled,
657669
) = self._parse_element(site_xml, ns)
658670

659671
self._set_values(
@@ -708,6 +720,7 @@ def _parse_common_tags(self, site_xml, ns):
708720
time_zone,
709721
auto_suspend_refresh_enabled,
710722
auto_suspend_refresh_inactivity_window,
723+
attribute_capture_enabled,
711724
)
712725
return self
713726

@@ -764,6 +777,7 @@ def _set_values(
764777
time_zone,
765778
auto_suspend_refresh_enabled,
766779
auto_suspend_refresh_inactivity_window,
780+
attribute_capture_enabled,
767781
):
768782
if id is not None:
769783
self._id = id
@@ -871,6 +885,8 @@ def _set_values(
871885
self.auto_suspend_refresh_enabled = auto_suspend_refresh_enabled
872886
if auto_suspend_refresh_inactivity_window is not None:
873887
self.auto_suspend_refresh_inactivity_window = auto_suspend_refresh_inactivity_window
888+
if attribute_capture_enabled is not None:
889+
self.attribute_capture_enabled = attribute_capture_enabled
874890

875891
@classmethod
876892
def from_response(cls, resp, ns) -> List["SiteItem"]:
@@ -930,6 +946,7 @@ def from_response(cls, resp, ns) -> List["SiteItem"]:
930946
time_zone,
931947
auto_suspend_refresh_enabled,
932948
auto_suspend_refresh_inactivity_window,
949+
attribute_capture_enabled,
933950
) = cls._parse_element(site_xml, ns)
934951

935952
site_item = cls(name, content_url)
@@ -985,6 +1002,7 @@ def from_response(cls, resp, ns) -> List["SiteItem"]:
9851002
time_zone,
9861003
auto_suspend_refresh_enabled,
9871004
auto_suspend_refresh_inactivity_window,
1005+
attribute_capture_enabled,
9881006
)
9891007
all_site_items.append(site_item)
9901008
return all_site_items
@@ -1066,6 +1084,7 @@ def _parse_element(site_xml, ns):
10661084

10671085
flows_enabled = string_to_bool(site_xml.get("flowsEnabled", ""))
10681086
cataloging_enabled = string_to_bool(site_xml.get("catalogingEnabled", ""))
1087+
attribute_capture_enabled = string_to_bool(site_xml.get("attributeCaptureEnabled", ""))
10691088

10701089
return (
10711090
id,
@@ -1119,6 +1138,7 @@ def _parse_element(site_xml, ns):
11191138
time_zone,
11201139
auto_suspend_refresh_enabled,
11211140
auto_suspend_refresh_inactivity_window,
1141+
attribute_capture_enabled,
11221142
)
11231143

11241144

tableauserverclient/s B2C1 erver/request_factory.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,8 @@ def update_req(self, site_item: "SiteItem", parent_srv: Optional["Server"] = Non
691691
site_element.attrib["autoSuspendRefreshInactivityWindow"] = str(
692692
site_item.auto_suspend_refresh_inactivity_window
693693
)
694+
if site_item.attribute_capture_enabled is not None:
695+
site_element.attrib["attributeCaptureEnabled"] = str(site_item.attribute_capture_enabled).lower()
694696

695697
return ET.tostring(xml_request)
696698

@@ -795,6 +797,8 @@ def create_req(self, site_item: "SiteItem", parent_srv: Optional["Server"] = Non
795797
site_element.attrib["autoSuspendRefreshInactivityWindow"] = str(
796798
site_item.auto_suspend_refresh_inactivity_window
797799
)
800+
if site_item.attribute_capture_enabled is not None:
801+
site_element.attrib["attributeCaptureEnabled"] = str(site_item.attribute_capture_enabled).lower()
798802

799803
return ET.tostring(xml_request)
800804

0 commit comments

Comments
 (0)
0