diff --git a/recommender/recommender.py b/recommender/recommender.py index 15cf914..1876c7f 100644 --- a/recommender/recommender.py +++ b/recommender/recommender.py @@ -48,6 +48,12 @@ def emit(param1, param2): pass +def load(path): + """Handy helper for getting resources from our kit.""" + data = pkg_resources.resource_string(__name__, path) + return data.decode("utf8") + + def stem_url(url): """ Get the base form of url. @@ -996,9 +1002,9 @@ def studio_view(self, _context=None): # pylint: disable=unused-argument self._init_template_lookup() frag = Fragment(template_lookup.get_template("recommenderstudio.html").render()) - frag.add_css(pkg_resources.resource_string(__name__, "static/css/recommenderstudio.css")) + frag.add_css(load("static/css/recommenderstudio.css")) frag.add_javascript_url("//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js") - frag.add_javascript(pkg_resources.resource_string(__name__, "static/js/src/recommenderstudio.js")) + frag.add_javascript(load("static/js/src/recommenderstudio.js")) frag.initialize_js('RecommenderXBlock') return frag diff --git a/setup.py b/setup.py index 5785576..a15a4b6 100644 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ def package_data(pkg, root_list): setup( name='recommender-xblock', - version='1.4.8', + version='1.4.9', description='recommender XBlock', # TODO: write a better description. long_description=README, author='edX',