Skip to content

[BB-3057] Use BytesIO as unicodecsv expects a bytestream, not unicode - #259

Merged
lgp171188 merged 1 commit into
opencraft-release/juniper.3from
guruprasad/BB-3057-sysadmin-dashboard-csv-download-fix
Sep 28, 2020
Merged

[BB-3057] Use BytesIO as unicodecsv expects a bytestream, not unicode#259
lgp171188 merged 1 commit into
opencraft-release/juniper.3from
guruprasad/BB-3057-sysadmin-dashboard-csv-download-fix

Conversation

@lgp171188

Copy link
Copy Markdown

This fixes the error thrown when trying to download the list of all
users, staff and instructors from the Sysadmin dashboard

Reference: unicodecsv README file

Testing instructions:

  • In the Juniper devstack, enable the Sysadmin dashboard by setting the ENABLE_SYSADMIN_DASHBOARD feature flag to true in /edx/etc/lms.yml and restart the LMS.
  • Log in to the LMS as a user with superuser permissions.
  • Navigate to the Sysadmin dashboard by clicking on the link in the top nav bar.
  • In the Users section, try to download a list of all the users in CSV file format. An exception complaining TypeError: string argument expected, got 'bytes' will be thrown.
  • In the Staffing and enrollment section, try downloading the staff and instructor list in a CSV file format. A similar exception will be thrown.
  • In a sandbox/production Juniper environment, a 500 internal server error response page will be shown and the same exception will be logged in the LMS logs.
  • Checkout the source branch of this PR.
  • Repeat the previous two steps and verify that the files can be downloaded and no errors are thrown.
  • Also verify that the downloaded files contain the expected data.

This fixes the error thrown when trying to download the list of all
users, staff and instructors from the Sysadmin dashboard

@farhaanbukhsh farhaanbukhsh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Have tested this and this works fine, I could reproduce the issues and verify the fix.

  • I tested this: Verify the branch on devstack and saw it was giving the issue, used this branch and I could see it fixing it. Tried downloading file and verified the data
  • I read through the code
  • I checked for accessibility issues
  • Includes documentation Doesn't require the documentation
  • I made sure any change in configuration variables is reflected in the corresponding client's configuration-secure repository.

@lgp171188
lgp171188 merged commit 53f23c4 into opencraft-release/juniper.3 Sep 28, 2020
@Agrendalath
Agrendalath deleted the guruprasad/BB-3057-sysadmin-dashboard-csv-download-fix branch November 16, 2020 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants