Skip to content

Commit

Permalink
Partial fix for #7
Browse files Browse the repository at this point in the history
  • Loading branch information
jMyles committed Oct 24, 2012
1 parent 02eead8 commit 10dbfde
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion coldbrew/__init__.py
@@ -1,6 +1,6 @@
from coldbrew.exceptions import ColdBrewCompileError
from coldbrew.cache import get_cache_key, get_hexdigest, get_hashed_mtime
from django.conf import settings
from . import settings
import logging
import os
import shlex
Expand Down
2 changes: 1 addition & 1 deletion coldbrew/cache.py
@@ -1,4 +1,4 @@
from django.conf import settings
from . import settings
from django.core.cache import cache
from django.utils.encoding import smart_str
from django.utils.hashcompat import md5_constructor
Expand Down
11 changes: 6 additions & 5 deletions coldbrew/templatetags/coldbrew.py
Expand Up @@ -2,6 +2,7 @@
from .. import compile, get_string_from_path
from ..exceptions import ColdBrewCompileError
from django.conf import settings
from .. import settings as coldbrew_settings
from django.core.cache import cache
from django.template.base import Library, Node

Expand All @@ -26,13 +27,13 @@ def compile(self, source):
def render(self, context):
output = self.nodelist.render(context)

if settings.COFFEESCRIPT_USE_CACHE:
if coldbrew_settings.COFFEESCRIPT_USE_CACHE:
cache_key = get_cache_key(get_hexdigest(output))
cached = cache.get(cache_key, None)
if cached is not None:
return cached
output = self.compile(output)
cache.set(cache_key, output, settings.COFFEESCRIPT_CACHE_TIMEOUT)
cache.set(cache_key, output, coldbrew_settings.COFFEESCRIPT_CACHE_TIMEOUT)
return output
else:
return self.compile(output)
Expand All @@ -54,10 +55,10 @@ def coffeescript(source_file_path):
else:
base_filename = filename

output_directory = os.path.join(settings.COFFEESCRIPT_LOCATION,
settings.COFFEESCRIPT_OUTPUT_DIR,
output_directory = os.path.join(coldbrew_settings.COFFEESCRIPT_LOCATION,
coldbrew_settings.COFFEESCRIPT_OUTPUT_DIR,
os.path.dirname(source_file_path))
full_path = os.path.join(settings.COFFEESCRIPT_LOCATION, source_file_path)
full_path = os.path.join(coldbrew_settings.COFFEESCRIPT_LOCATION, source_file_path)
hashed_mtime = get_hashed_mtime(full_path)
output_path = os.path.join(output_directory, "%s-%s.js" % (base_filename, hashed_mtime))

Expand Down

0 comments on commit 10dbfde

Please sign in to comment.