From: Ben Darnell Date: Mon, 8 Nov 2010 18:49:03 +0000 (-0800) Subject: Support "from x import y" in templates, not just "import x" X-Git-Tag: v1.2.0~84 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=965099eda08b376e18c42dffb7dfd4b5dd79dcc9;p=thirdparty%2Ftornado.git Support "from x import y" in templates, not just "import x" --- diff --git a/tornado/template.py b/tornado/template.py index 14cb967e2..5cc5e0034 100644 --- a/tornado/template.py +++ b/tornado/template.py @@ -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)