From e6b03704b1bb97c1d2f31301ecb4e3a687c536ea Mon Sep 17 00:00:00 2001 From: cewing Date: Mon, 1 Jun 2015 00:50:28 -0700 Subject: [PATCH] add a method to the `CCXBlockUsageLocator` class that will return a normal BlockUsageLocator. In keeping with the idea of a 'neutral' or 'course-local' version of ccx keys --- ccx_keys/locator.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ccx_keys/locator.py b/ccx_keys/locator.py index 183c37c..ad420ec 100644 --- a/ccx_keys/locator.py +++ b/ccx_keys/locator.py @@ -157,6 +157,13 @@ def ccx(self): """Returns the ccx for this object's course_key.""" return self.course_key.ccx + def to_block_locator(self): + return BlockUsageLocator( + course_key=self.course_key.to_course_locator(), + block_type=self.block_type, + block_id=self.block_id + ) + def _to_deprecated_string(self): """ CCXBlockUsageLocators are never deprecated. """ raise NotImplementedError