Support "from x import y" in templates, not just "import x"

This commit is contained in:
Ben Darnell 2010-11-08 10:49:03 -08:00
parent 3e44643d3b
commit 965099eda0
1 changed files with 3 additions and 2 deletions

View File

@ -532,7 +532,8 @@ def _parse(reader, in_block=None):
raise ParseError("Extra {%% end %%} block on line %d" % line)
return body
elif operator in ("extends", "include", "set", "import", "comment"):
elif operator in ("extends", "include", "set", "import", "from",
"comment"):
if operator == "comment":
continue
if operator == "extends":
@ -540,7 +541,7 @@ def _parse(reader, in_block=None):
if not suffix:
raise ParseError("extends missing file path on line %d" % line)
block = _ExtendsBlock(suffix)
elif operator == "import":
elif operator in ("import", "from"):
if not suffix:
raise ParseError("import missing statement on line %d" % line)
block = _Statement(contents)