|
a |
|
b/OSSEval/analysis/templatetags/form_tags.py |
|
|
1 |
from django import template
|
|
|
2 |
|
|
|
3 |
register = template.Library()
|
|
|
4 |
|
|
|
5 |
def do_page_form(parser, token):
|
|
|
6 |
try:
|
|
|
7 |
# split_contents() knows not to split quoted strings.
|
|
|
8 |
tag_name, format_string = token.split_contents()
|
|
|
9 |
except ValueError:
|
|
|
10 |
raise template.TemplateSyntaxError("%r tag requires a single argument" % token.contents.split()[0])
|
|
|
11 |
if not (format_string[0] == format_string[-1] and format_string[0] in ('"', "'")):
|
|
|
12 |
raise template.TemplateSyntaxError("%r tag's argument should be in quotes" % tag_name)
|
|
|
13 |
return format_string[1:-1] |