From: Kevin Date: Sun, 10 May 2020 19:49:26 +0000 (-0400) Subject: Switch From node to use constructor X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2c2a04f3c6886d5f1ad47e19096ac0911db34056;p=thirdparty%2Fjinja.git Switch From node to use constructor This ensures that `with_context` is properly initialized even though we don't currently support it. --- diff --git a/new_parser.py b/new_parser.py index 5e034fbc..56a8915a 100644 --- a/new_parser.py +++ b/new_parser.py @@ -98,17 +98,21 @@ def parse_block_for(ast): ) def parse_block_from(ast): - names = [] parameters = ast['block']['parameters'] + template = parse_variable(parameters[0]['value']) + names = [] + with_context = False + if len(parameters) > 2: names = []#parameters[2:] from_import = nodes.FromImport( + template, + names, + with_context, lineno=lineno_from_parseinfo(ast['parseinfo']) ) - from_import.template = parse_variable(parameters[0]['value']) - from_import.names = names return from_import