Permalink
Browse files

Merge pull request #1 from peterbe/jinja-offline

Jinja offline
  • Loading branch information...
gugu committed Oct 26, 2012
2 parents d542745 + 7cb3af3 commit c5e6de7c4914a0264bc4f4b4b68e1c1823f13a8a
Showing with 8 additions and 6 deletions.
  1. +2 −1 .gitignore
  2. +6 −5 compressor/contrib/jinja2ext.py
View
@@ -9,4 +9,5 @@ MANIFEST
*.egg
docs/_build/
.sass-cache
-.coverage
+.coverage
+/htmlcov/
@@ -3,9 +3,10 @@
from jinja2.exceptions import TemplateSyntaxError
from compressor.exceptions import OfflineGenerationError
from compressor.templatetags.compress import OUTPUT_FILE, CompressorMixin
-from compressor.cache import (get_offline_hexdigest,
+from compressor.cache import (get_offline_hexdigest,
get_offline_manifest)
+
class CompressorExtension(CompressorMixin, Extension):
tags = set(['compress'])
@@ -31,7 +32,7 @@ def parse(self, parser):
args.append(nodes.Const('file'))
args.append(nodes.ContextReference())
body = parser.parse_statements(['name:endcompress'], drop_needle=True)
- return nodes.CallBlock(self.call_method('_compress', args), [], [],
+ return nodes.CallBlock(self.call_method('_compress', args), [], [],
body).set_lineno(lineno)
def _compress(self, kind, mode, context, caller):
@@ -40,13 +41,13 @@ def _compress(self, kind, mode, context, caller):
mode = mode or OUTPUT_FILE
original_content = caller()
- context = {
+ context = {
'original_content': original_content
- }
+ }
return self.render_compressed(context, kind, mode, forced=forced)
def render_offline(self, context, forced):
- """
+ """
If enabled and in offline mode, and not forced check the offline cache
and return the result if given
"""

0 comments on commit c5e6de7

Please sign in to comment.