From 33f56e1bba9ded25677a5f6719a7ec764c737ae8 Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Thu, 20 Feb 2014 14:57:56 -0500 Subject: [PATCH] Call unicode() instead of str() for textbook IDs STUD-1327 --- cms/djangoapps/contentstore/views/course.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py index d906b1e5a8..f73c1ef983 100644 --- a/cms/djangoapps/contentstore/views/course.py +++ b/cms/djangoapps/contentstore/views/course.py @@ -738,7 +738,7 @@ def validate_textbook_json(textbook): raise TextbookValidationError("must be JSON object") if not textbook.get("tab_title"): raise TextbookValidationError("must have tab_title") - tid = str(textbook.get("id", "")) + tid = unicode(textbook.get("id", "")) if tid and not tid[0].isdigit(): raise TextbookValidationError("textbook ID must start with a digit") return textbook @@ -853,7 +853,7 @@ def textbooks_detail_handler(request, tid, tag=None, package_id=None, branch=Non ) store = get_modulestore(course.location) matching_id = [tb for tb in course.pdf_textbooks - if str(tb.get("id")) == str(tid)] + if unicode(tb.get("id")) == unicode(tid)] if matching_id: textbook = matching_id[0] else: