Commit eec19992 by Syed Hassan Raza

Handle unicode through try catch

parent b3e7516a
......@@ -55,9 +55,7 @@ class VideoStudentViewHandlers(object):
if dispatch == 'save_user_state':
for key in data:
if type(key) == str:
key = unicode(key, "UTF8")
if hasattr(self, key.encode('utf8')) and key in accepted_keys:
if key in accepted_keys:
if key in conversions:
value = conversions[key](data[key])
else:
......
......@@ -153,7 +153,7 @@ class TestVideo(BaseTestXmodule):
self.item_descriptor.handle_ajax('save_user_state', {'transcript_language': "uk"})
self.assertEqual(self.item_descriptor.transcript_language, 'uk')
response = self.item_descriptor.handle_ajax('save_user_state', {'demoo�': "sample"})
response = self.item_descriptor.handle_ajax('save_user_state', {u'demoo�': "sample"})
self.assertEqual(json.loads(response)['success'], True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment