From c23c5cc3d99c1772c339bc287c7c78de00945ea8 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Thu, 7 Mar 2013 16:12:21 -0500 Subject: [PATCH] add comments --- common/djangoapps/static_replace/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/djangoapps/static_replace/__init__.py b/common/djangoapps/static_replace/__init__.py index c839212c26..b73a658c5f 100644 --- a/common/djangoapps/static_replace/__init__.py +++ b/common/djangoapps/static_replace/__init__.py @@ -87,11 +87,15 @@ def replace_static_urls(text, data_directory, course_namespace=None): # In debug mode, if we can find the url as is, if settings.DEBUG and finders.find(rest, True): return original - # course_namespace is not None, then use studio style urls + # if we're running with a MongoBacked store course_namespace is not None, then use studio style urls elif course_namespace is not None and not isinstance(modulestore(), XMLModuleStore): + # first look in the static file pipeline and see if we are trying to reference + # a piece of static content which is in the mitx repo (e.g. JS associated with an xmodule) if staticfiles_storage.exists(rest): url = staticfiles_storage.url(rest) else: + # if not, then assume it's courseware specific content and then look in the + # Mongo-backed database url = StaticContent.convert_legacy_static_url(rest, course_namespace) # Otherwise, look the file up in staticfiles_storage, and append the data directory if needed else: