From 01bc1cb293568a49f95131706c6fb58e57831728 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 5 May 2016 11:09:28 +0200 Subject: [PATCH 1/3] fixed call to text_type in filter.py, resulting in a decoding error before --- requirejs/filter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirejs/filter.py b/requirejs/filter.py index d6f42e9..37e5291 100644 --- a/requirejs/filter.py +++ b/requirejs/filter.py @@ -80,7 +80,7 @@ def get_bundle_content(module, original_content): Returns the rewritten content of the module and None if no define-call was found. """ - text_content = text_type(original_content, settings.FILE_CHARSET) + text_content = text_type(original_content) define_call = define_replace_pattern.findall(text_content) if define_call: if not module.named: From 32ff3ff69c3499d90b8f394613fba59571c0234c Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 4 Aug 2016 11:43:55 +0200 Subject: [PATCH 2/3] made it compatible with django 1.10 --- requirejs/filter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirejs/filter.py b/requirejs/filter.py index 37e5291..b466397 100644 --- a/requirejs/filter.py +++ b/requirejs/filter.py @@ -39,7 +39,7 @@ def __init__(self, content, attrs=None, filter_type=None, charset=None, filename # noinspection PyMethodMayBeStatic def get_module_finder(self, main=None): - template_directories = settings.TEMPLATE_DIRS + get_app_template_dirs() + template_directories = settings.TEMPLATES[0]['DIRS'] + get_app_template_dirs() shim_dependencies = list(chain(*[s.get('deps', []) for s in CONFIG.get('shim', {}).values()])) main_dependency = [main] if main else [] dependencies = shim_dependencies + main_dependency From 19a51c0d0dc0c796adc8a42ebd4e4b8fcfc0b7c0 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 14 Feb 2017 21:09:40 +0100 Subject: [PATCH 3/3] fixed bug when javascript files are unicode --- requirejs/finder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirejs/finder.py b/requirejs/finder.py index db605fa..51624b9 100644 --- a/requirejs/finder.py +++ b/requirejs/finder.py @@ -154,7 +154,7 @@ def get_module_name(name): @staticmethod def get_module_content(path): - with open(path, 'r') as f: + with open(path, 'r', encoding='utf8') as f: return f.read() @staticmethod