From 2dcdeff4b6d47b333971e74cd47eece1a86546c0 Mon Sep 17 00:00:00 2001 From: Victor Shnayder Date: Mon, 11 Feb 2013 17:07:15 -0500 Subject: [PATCH] Make replace_static_urls leave alone urls that have '?raw' at the end - needed for GWT'ed modules that rely on the filename to find dependencies --- common/djangoapps/static_replace/__init__.py | 20 +++++++++--- .../test/test_static_replace.py | 31 +++++++++++++++++-- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/common/djangoapps/static_replace/__init__.py b/common/djangoapps/static_replace/__init__.py index d41688530e..088ba09181 100644 --- a/common/djangoapps/static_replace/__init__.py +++ b/common/djangoapps/static_replace/__init__.py @@ -13,12 +13,22 @@ log = logging.getLogger(__name__) def _url_replace_regex(prefix): + """ + Match static urls in quotes that don't end in '?raw'. + + I'm sorry. http://xkcd.com/1171/ + + (?\\?['"]) # the opening quotes - (?P{prefix}) # theeprefix - (?P.*?) # everything else in the url - (?P=quote) # the first matching closing quote + (?x) # flags=re.VERBOSE + (?P\\?['"]) # the opening quotes + (?P{prefix}) # the prefix + (?P.*? # everything else in the url... + (?