[WIP] Campus SE-1155 fix crashes on non-ascii in ccx enrollments

Description

Currently, non-ascii characters in ccx enrollments textbox crash the server when bulk enrolling/unenrolling, and non-ascii chars in usernames crash the server when downloading student grades for a ccx course.

Additionally, the log calls would crash with a traceback (while not affecting the program flow).

It appears to be related to invalid mixing of `str` and `unicode` types in python2.

This PR aims to fix these issues.

*JIRA tickets*: TBD

*Dependencies*: None

*Sandbox URL*: TBD - sandbox is being provisioned.

*Merge deadline*: None

*Testing instructions*:

1. enable CCX and unicode usernames (see settings below)
1. create a CCX course
1. register a new user with a username that contains non-ascii characters
1. navigate to the ccx coach dashboard
1. enter a username that contains non-ascii characters and also does not exist in the system
1. click 'enroll'
1. verify that the server doesn't crash and correctly replies with "Could not find a user with name or email "<username here>""
1. enter the username of the previously registered user
1. click 'enroll'
1. verify that the user has been enrolled
1. navigate to the 'Student Admin' tab
1. click 'Download student grades'
1. verify that the csv file is correctly generated and downloads
1. navigate back to the ccx enrollment tab
1. enter the previously registered username
1. click 'unenroll'
1. verify correctly unenrolls
1. enter another username that contains non-ascii characters
1. click 'unenroll'
1. verify that correct error message is shown and no server crash
1. check the lms-logs - there should be no tracebacks from logging calls crashing

*Author notes and concerns*:

  • This is still a work in progress; only the non-ascii in enrollment text box has been fixed so far.

*Reviewers*

  • [ ] @pomegranited

  • [ ] edX reviewer[s] TBD

*Settings*
```yaml
EDXAPP_FEATURES:
CUSTOM_COURSES_EDX: true
ENABLE_UNICODE_USERNAME: true
ALLOW_UNICODE_COURSE_ID: true
```

Status

Assignee

Unassigned

Reporter

Open Source Pull Request Bot

Labels

Contributor Name

Samuel Walladge

Repo

edx/edx-platform

Customer

Epic Link

None

OSCM Assignee

None

Priority

Unset
Configure