aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2014-04-20 20:26:05 -0400
committerTeddy Wing2014-04-20 20:26:05 -0400
commit4b8f99b9fe2f587b598b0a1d57c01906f1c35dc7 (patch)
tree7b255882b7301493c947523057404296f5d78fe0
parentf6dd562aeb98d539e2972ea6d3e3c5c975136f5c (diff)
downloaddjango-sneak-peek-4b8f99b9fe2f587b598b0a1d57c01906f1c35dc7.tar.bz2
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.
-rw-r--r--sneak_peek_tag/templatetags/sneak_peek.py4
1 files changed, 3 insertions, 1 deletions
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):