Skip to content

Instantly share code, notes, and snippets.

from django import template
def __is_quoted(str):
return (str[0] == str[-1] and str[0] in ('"', "'"))
def __process_quoted(tag_name, str):
if not __is_quoted(str):
raise template.TemplateSyntaxError("%r tag's argument %s should be in quotes" % (tag_name, str))
return str[1:-1]