From c9285de4335899bcca4fc1750db8ea6ec808873e Mon Sep 17 00:00:00 2001 From: Don Mitchell Date: Wed, 26 Feb 2014 16:37:39 -0500 Subject: [PATCH] unicode correctly and understandably --- common/lib/xmodule/xmodule/modulestore/locator.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/common/lib/xmodule/xmodule/modulestore/locator.py b/common/lib/xmodule/xmodule/modulestore/locator.py index b76ca4861a..2ba86da43c 100644 --- a/common/lib/xmodule/xmodule/modulestore/locator.py +++ b/common/lib/xmodule/xmodule/modulestore/locator.py @@ -204,16 +204,14 @@ class CourseLocator(Locator): """ Return a string representing this location. """ - result = u"" + parts = [] if self.package_id: - result += unicode(self.package_id) + parts.append(unicode(self.package_id)) if self.branch: - result += '/' + BRANCH_PREFIX + self.branch + parts.append(u"{prefix}{branch}".format(prefix=BRANCH_PREFIX, branch=self.branch)) if self.version_guid: - if self.package_id: - result += u"/" - result += u"{prefix}{guid}".format(prefix=VERSION_PREFIX, guid=self.version_guid) - return result + parts.append(u"{prefix}{guid}".format(prefix=VERSION_PREFIX, guid=self.version_guid)) + return u"/".join(parts) def url(self): """