Skip to content

Commit

Permalink
Fixed the type checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryant Howell committed Jan 3, 2020
1 parent 82917e4 commit c327dea
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tableau_rest_api/published_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,18 +950,20 @@ def are_permissions_locked(self) -> bool:
def lock_permissions(self):
self.start_log_block()
if self.permissions_locked is False:
# This allows type checking without importing the class
if(type(self.t_rest_api).__name__.find('TableauRestApiConnection') != -1):
self.t_rest_api.update_project(self.luid, locked_permissions=True)
if(type(self.t_rest_api).__name__.find('TableauServerRest') != -1):
else:
self.t_rest_api.projects.update_project(self.luid, locked_permissions=True)
self.end_log_block()

def unlock_permissions(self):
self.start_log_block()
if self.permissions_locked is True:
# This allows type checking without importing the class
if(type(self.t_rest_api).__name__.find('TableauRestApiConnection') != -1):
self.t_rest_api.update_project(self.luid, locked_permissions=False)
if(type(self.t_rest_api).__name__.find('TableauServerRest') != -1):
else:
self.t_rest_api.projects.update_project(self.luid, locked_permissions=False)

self.end_log_block()
Expand Down Expand Up @@ -1047,12 +1049,12 @@ def parent_project_luid(self) -> str:

def query_child_projects(self) -> ET.Element:
self.start_log_block()
# This allows type checking without importing the class
if (type(self.t_rest_api).__name__.find('TableauRestApiConnection') != -1):
projects = self.t_rest_api.query_projects()
elif(type(self.t_rest_api).__name__.find('TableauServerRest') != -1):
projects = self.t_rest_api.projects.query_projects()
else:
raise InvalidOptionException('t_rest_api needs to be either TableauRestApiConnection or TableauServerRest descended')
projects = self.t_rest_api.projects.query_projects()

child_projects = projects.findall('.//t:project[@parentProjectId="{}"]'.format(self.luid), self.t_rest_api.ns_map)
self.end_log_block()
return child_projects
Expand Down

0 comments on commit c327dea

Please sign in to comment.