Skip to content

Instantly share code, notes, and snippets.

@prestontimmons
Created April 14, 2011 21:05
Show Gist options
  • Save prestontimmons/920546 to your computer and use it in GitHub Desktop.
Save prestontimmons/920546 to your computer and use it in GitHub Desktop.
Matching template variables in Django
try:
variable_name = re.search("as (\w+)", token.contents).group(1)
except AttributeError:
raise template.TemplateSyntaxError, \
"%r tag had invalid arguments." % token.split_contents()[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment