Skip to content

Commit

Permalink
A lot of Python 2 style Unicode output needed to be simplified and ju…
Browse files Browse the repository at this point in the history
…st use regular strings for Python 3
  • Loading branch information
Bryant Howell committed May 21, 2020
1 parent a46b473 commit f222687
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions examples/permissions_auditing.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
default.enable_logging(logger)
default.signin()

with open('permissions_audit.txt', 'wb') as output_file:
with open('permissions_audit.txt', 'w') as output_file:

# Get all sites content urls for logging in
site_content_urls = default.query_all_site_content_urls()
Expand All @@ -25,13 +25,13 @@

project_caps = Permissions.available_capabilities[default.api_version]['project']
for cap in project_caps:
headers.append(',{}'.format(cap))
headers.append(cap)
workbook_caps = Permissions.available_capabilities[default.api_version]['workbook']
for cap in workbook_caps:
headers.append(',{}'.format(cap))
headers.append(cap)
datasource_caps = Permissions.available_capabilities[default.api_version]['datasource']
for cap in datasource_caps:
headers.append(',{}'.format(cap))
headers.append(cap)
output_writer.writerow(headers)

for site_content_url in site_content_urls:
Expand All @@ -53,13 +53,13 @@
all_perms_list = proj_obj.convert_all_permissions_to_list(all_perms[luid])
if site_content_url is None:
site_content_url = ''
output_row.append(site_content_url.encode('utf-8'))
output_row.append(project.encode('utf-8'))
output_row.append(projects_dict[project].encode('utf-8'))
output_row.append(site_content_url)
output_row.append(project)
output_row.append(projects_dict[project])
output_row.append(str(proj_obj.are_permissions_locked()))
output_row.append(all_perms[luid]["type"].encode('utf-8'))
output_row.append(all_perms[luid]["name"].encode('utf-8'))
output_row.append(luid.encode('utf-8'))
output_row.append(all_perms[luid]["type"])
output_row.append(all_perms[luid]["name"])
output_row.append(luid)
output_row.extend(all_perms_list)
output_writer.writerow(output_row)

Expand Down

0 comments on commit f222687

Please sign in to comment.