File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -466,7 +466,8 @@ def tokenGenerator(self, baseTokens):
466
466
if (kind == 'gybBlockOpen' ):
467
467
# Absorb any '}% <optional-comment> \n'
468
468
m2 = gybBlockClose .match (self .template , closePos )
469
- assert m2 , "Invalid block closure" # FIXME: need proper error handling here.
469
+ if not m2 :
470
+ raise ValueError ("Invalid block closure" )
470
471
nextPos = m2 .end (0 )
471
472
else :
472
473
assert kind == 'substitutionOpen'
@@ -656,7 +657,9 @@ def execute(self, context):
656
657
# Execute the code with our __children__ in scope
657
658
context .localBindings ['__children__' ] = self .children
658
659
result = eval (self .code , context .localBindings )
659
- assert context .localBindings ['__children__' ] is self .children
660
+
661
+ if context .localBindings ['__children__' ] is not self .children :
662
+ raise ValueError ("The code is not allowed to mutate __children__" )
660
663
# Restore the bindings
661
664
context .localBindings ['__children__' ] = saveChildren
662
665
You can’t perform that action at this time.
0 commit comments