]> Devi Nivas Git - chevron.git/commitdiff
Fixed IndexError on scopes
authornoah morrison <noah@morrison.ph>
Sat, 8 Nov 2014 03:00:38 +0000 (22:00 -0500)
committernoah morrison <noah@morrison.ph>
Sat, 8 Nov 2014 03:00:38 +0000 (22:00 -0500)
If there are no scopes it defaults to None

entei.py

index 3a3414d5e284135899ff0007aea6261f7d849c3e..08b9a1515bdff3807cd6dcb2373de020710e4dfa 100755 (executable)
--- a/entei.py
+++ b/entei.py
@@ -192,10 +192,15 @@ def render(template, data, partials_path='.', partials_ext='mustache',
         scopes = [data]
 
     for tag, key in tokens:
+        try:
+            current_scope = scopes[0]
+        except IndexError:
+            current_scope = None
+
         if tag == 'end':
             scopes = scopes[1:]
 
-        elif not scopes[0] and len(scopes) != 1:
+        elif not current_scope and len(scopes) != 1:
             pass
 
         elif tag == 'literal':