File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 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):
466466 if (kind == 'gybBlockOpen' ):
467467 # Absorb any '}% <optional-comment> \n'
468468 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" )
470471 nextPos = m2 .end (0 )
471472 else :
472473 assert kind == 'substitutionOpen'
@@ -656,7 +657,9 @@ def execute(self, context):
656657 # Execute the code with our __children__ in scope
657658 context .localBindings ['__children__' ] = self .children
658659 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__" )
660663 # Restore the bindings
661664 context .localBindings ['__children__' ] = saveChildren
662665
You can’t perform that action at this time.
0 commit comments