Support "from x import y" in templates, not just "import x"
This commit is contained in:
parent
3e44643d3b
commit
965099eda0
|
@ -532,7 +532,8 @@ def _parse(reader, in_block=None):
|
||||||
raise ParseError("Extra {%% end %%} block on line %d" % line)
|
raise ParseError("Extra {%% end %%} block on line %d" % line)
|
||||||
return body
|
return body
|
||||||
|
|
||||||
elif operator in ("extends", "include", "set", "import", "comment"):
|
elif operator in ("extends", "include", "set", "import", "from",
|
||||||
|
"comment"):
|
||||||
if operator == "comment":
|
if operator == "comment":
|
||||||
continue
|
continue
|
||||||
if operator == "extends":
|
if operator == "extends":
|
||||||
|
@ -540,7 +541,7 @@ def _parse(reader, in_block=None):
|
||||||
if not suffix:
|
if not suffix:
|
||||||
raise ParseError("extends missing file path on line %d" % line)
|
raise ParseError("extends missing file path on line %d" % line)
|
||||||
block = _ExtendsBlock(suffix)
|
block = _ExtendsBlock(suffix)
|
||||||
elif operator == "import":
|
elif operator in ("import", "from"):
|
||||||
if not suffix:
|
if not suffix:
|
||||||
raise ParseError("import missing statement on line %d" % line)
|
raise ParseError("import missing statement on line %d" % line)
|
||||||
block = _Statement(contents)
|
block = _Statement(contents)
|
||||||
|
|
Loading…
Reference in New Issue