From 4b8f99b9fe2f587b598b0a1d57c01906f1c35dc7 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 20 Apr 2014 20:26:05 -0400 Subject: sneak_peek.py: change first arg to use quotes Require the template tag argument to be quoted. This allows us to specify multiple CSS class modifiers instead of just one. --- sneak_peek_tag/templatetags/sneak_peek.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sneak_peek_tag') diff --git a/sneak_peek_tag/templatetags/sneak_peek.py b/sneak_peek_tag/templatetags/sneak_peek.py index b9a88de..6578ecc 100644 --- a/sneak_peek_tag/templatetags/sneak_peek.py +++ b/sneak_peek_tag/templatetags/sneak_peek.py @@ -10,9 +10,11 @@ def sneak_peek(parser, token): tag, style = token.split_contents() except ValueError: pass + if not (style[0] == style[-1] and style[0] in ('"', "'")): + raise template.TemplateSyntaxError("%r tag's argument should be in quotes" % tag) nodelist = parser.parse(('endsneak_peek',)) parser.delete_first_token() - return SneakPeekWrapper(nodelist, style) + return SneakPeekWrapper(nodelist, style[1:-1]) class SneakPeekWrapper(Node): -- cgit v1.2.3