Skip to content

Commit

Permalink
Modified templatize to ignore non-haml files (fix)
Browse files Browse the repository at this point in the history
  • Loading branch information
cordery committed Aug 23, 2013
1 parent fd3c93d commit 62bc8cb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions hamlpy/templatize.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
"""
This module decorates the django templatize function to parse haml templates
before the translation utility extracts tags from it.
--Modified to ignore non-haml files.
"""

try:
from django.utils.translation import trans_real
_django_available = True
except ImportError, e:
_django_available = False

import hamlpy
import os


def decorate_templatize(func):
def templatize(src, origin=None):
#if the template has no origin file then do not attempt to parse it with haml
Expand All @@ -26,6 +26,6 @@ def templatize(src, origin=None):
src = html.encode('utf-8')
return func(src, origin)
return templatize

if _django_available:
trans_real.templatize = decorate_templatize(trans_real.templatize)
trans_real.templatize = decorate_templatize(trans_real.templatize)

0 comments on commit 62bc8cb

Please sign in to comment.