Skip to content

Commit 1fcdc12

Browse files
committed
Addressing comment
1 parent f5f57f4 commit 1fcdc12

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

samples/publish_workbook.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def main():
2929
parser.add_argument('--filepath', '-f', required=True, help='filepath to the workbook to publish')
3030
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
3131
help='desired logging level (set to error by default)')
32-
parser.add_argument('--as_job', '-a', help='Publishing asynchronously', action='store_true')
32+
parser.add_argument('--as-job', '-a', help='Publishing asynchronously', action='store_true')
3333

3434
args = parser.parse_args()
3535

@@ -54,7 +54,7 @@ def main():
5454
# Step 3: If default project is found, form a new workbook item and publish.
5555
if default_project is not None:
5656
new_workbook = TSC.WorkbookItem(default_project.id)
57-
if args.as_job is True:
57+
if args.as_job:
5858
new_job = server.workbooks.publish(new_workbook, args.filepath, overwrite_true, args.as_job)
5959
print("Workbook published. JOB ID: {0}".format(new_job.id))
6060
else:

tableauserverclient/server/endpoint/datasources_endpoint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def refresh(self, datasource_item):
152152
# Publish datasource
153153
@api(version="2.0")
154154
@parameter_added_in(as_job='3.0')
155-
def publish(self, datasource_item, file_path, mode, as_job=False, connection_credentials=None):
155+
def publish(self, datasource_item, file_path, mode, connection_credentials=None, as_job=False):
156156
if not os.path.isfile(file_path):
157157
error = "File path does not lead to an existing file."
158158
raise IOError(error)
@@ -175,7 +175,7 @@ def publish(self, datasource_item, file_path, mode, as_job=False, connection_cre
175175
if mode == self.parent_srv.PublishMode.Overwrite or mode == self.parent_srv.PublishMode.Append:
176176
url += '&{0}=true'.format(mode.lower())
177177

178-
if as_job is True:
178+
if as_job:
179179
url += '&{0}=true'.format('asJob')
180180

181181
# Determine if chunking is required (64MB is the limit for single upload method)
@@ -195,7 +195,7 @@ def publish(self, datasource_item, file_path, mode, as_job=False, connection_cre
195195
connection_credentials)
196196
server_response = self.post_request(url, xml_request, content_type)
197197

198-
if as_job is True:
198+
if as_job:
199199
new_job = JobItem.from_response(server_response.content, self.parent_srv.namespace)[0]
200200
logger.info('Published {0} (JOB_ID: {1}'.format(filename, new_job.id))
201201
return new_job

tableauserverclient/server/endpoint/workbooks_endpoint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def _get_wb_preview_image(self, workbook_item):
200200
# Publishes workbook. Chunking method if file over 64MB
201201
@api(version="2.0")
202202
@parameter_added_in(as_job='3.0')
203-
def publish(self, workbook_item, file_path, mode, as_job=False, connection_credentials=None):
203+
def publish(self, workbook_item, file_path, mode, connection_credentials=None, as_job=False):
204204
if not os.path.isfile(file_path):
205205
error = "File path does not lead to an existing file."
206206
raise IOError(error)
@@ -226,7 +226,7 @@ def publish(self, workbook_item, file_path, mode, as_job=False, connection_crede
226226
error = 'Workbooks cannot be appended.'
227227
raise ValueError(error)
228228

229-
if as_job is True:
229+
if as_job:
230230
url += '&{0}=true'.format('asJob')
231231

232232
# Determine if chunking is required (64MB is the limit for single upload method)
@@ -245,7 +245,7 @@ def publish(self, workbook_item, file_path, mode, as_job=False, connection_crede
245245
file_contents,
246246
connection_credentials)
247247
server_response = self.post_request(url, xml_request, content_type)
248-
if as_job is True:
248+
if as_job:
249249
new_job = JobItem.from_response(server_response.content, self.parent_srv.namespace)[0]
250250
logger.info('Published {0} (JOB_ID: {1}'.format(filename, new_job.id))
251251
return new_job

0 commit comments

Comments
 (0)