Skip to content

Commit 31554c5

Browse files
vogelsgesangjacalata
authored andcommitted
Accept None as parameter for the site_id of TableauAuth and PersonalAccessTokenAuth (#925)
* Accept `None` as parameter for the `site_id` of `TableauAuth` and `PersonalAccessTokenAuth` As part of #889, I changed the default value for the `site` argument to be `None` instead of an empty string. This accidentally broke auth, as `TableauAuth` expected an empty string instead of `None` to signify an absent `site` argument. This commit fixes the issue by now actually accepting `None` as `site_id` in `TableauAuth` and `PersonalAccessTokenAuth`, thereby making our interface more intuitive, at least in my opinion. Fixes #924
1 parent 820005c commit 31554c5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

tableauserverclient/models/personal_access_token_auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
class PersonalAccessTokenAuth(object):
2-
def __init__(self, token_name, personal_access_token, site_id=""):
2+
def __init__(self, token_name, personal_access_token, site_id=None):
33
self.token_name = token_name
44
self.personal_access_token = personal_access_token
5-
self.site_id = site_id
5+
self.site_id = site_id if site_id is not None else ""
66
# Personal Access Tokens doesn't support impersonation.
77
self.user_id_to_impersonate = None
88

tableauserverclient/models/tableau_auth.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
class TableauAuth(object):
2-
def __init__(self, username, password, site=None, site_id="", user_id_to_impersonate=None):
2+
def __init__(self, username, password, site=None, site_id=None, user_id_to_impersonate=None):
33
if site is not None:
44
import warnings
55

66
warnings.warn(
7-
'TableauAuth(...site=""...) is deprecated, ' 'please use TableauAuth(...site_id=""...) instead.',
7+
"TableauAuth(..., site=...) is deprecated, " "please use TableauAuth(..., site_id=...) instead.",
88
DeprecationWarning,
99
)
1010
site_id = site
1111

1212
self.user_id_to_impersonate = user_id_to_impersonate
1313
self.password = password
14-
self.site_id = site_id
14+
self.site_id = site_id if site_id is not None else ""
1515
self.username = username
1616

1717
@property

0 commit comments

Comments
 (0)