From 51da768bce901096fde03139fe95649f6a89e502 Mon Sep 17 00:00:00 2001 From: Dean Malmgren Date: Thu, 2 Jan 2014 17:29:02 -0600 Subject: [PATCH 1/2] made it possible to specify a HAMLPY_VALID_EXTENSIONS variable to add other file extensions to the hamlpy.VALID_EXTENSIONS global variable --- hamlpy/hamlpy.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hamlpy/hamlpy.py b/hamlpy/hamlpy.py index 4aa5037..cd7c452 100755 --- a/hamlpy/hamlpy.py +++ b/hamlpy/hamlpy.py @@ -4,6 +4,13 @@ import sys VALID_EXTENSIONS=['haml', 'hamlpy'] +try: + from django.conf import settings +except ImportError, e: + pass +else: + if hasattr(settings, 'HAMLPY_VALID_EXTENSIONS'): + VALID_EXTENSIONS.extend(settings.HAMLPY_VALID_EXTENSIONS) class Compiler: From 0f5e0d5b45493984efc92eb909e2289397b733b0 Mon Sep 17 00:00:00 2001 From: Dean Malmgren Date: Thu, 2 Jan 2014 17:34:09 -0600 Subject: [PATCH 2/2] added documentation about HAMLPY_VALID_EXTENIONS --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index f3b3664..1736a9b 100644 --- a/readme.md +++ b/readme.md @@ -91,6 +91,7 @@ For caching, just add `django.template.loaders.cached.Loader` to your TEMPLATE_L Following values in Django settings affect haml processing: * `HAMLPY_ATTR_WRAPPER` -- The character that should wrap element attributes. This defaults to ' (an apostrophe). + * `HAMLPY_VALID_EXTENSIONS` -- A list of additional file extensions that are loaded/watched by HamlPy. By default, HamlPy monitors files with `.haml` and `.hamlpy` extensions. ### Option 2: Watcher