diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-05-11 08:50:54 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-05-11 08:50:54 +0000 |
| commit | de5f67f17e9ab3f6a860ad93d6c1fbc2c0c7f3b2 (patch) | |
| tree | d3fa1dfc0160bc1a1dd5ab71fab1e9210f81a4ec /docs | |
| parent | f9982c5c08f02699dddf097986a6b3bed54bf5a5 (diff) | |
Fixed #4267 -- In example code, extract the template tag name correctly in
error messages where Token.split_contents() has failed. Thanks,
keisuke.nishida@gmail.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5188 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/templates_python.txt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/templates_python.txt b/docs/templates_python.txt index 853707f58c..08a287f572 100644 --- a/docs/templates_python.txt +++ b/docs/templates_python.txt @@ -717,7 +717,7 @@ object:: # split_contents() knows not to split quoted strings. tag_name, format_string = token.split_contents() except ValueError: - raise template.TemplateSyntaxError, "%r tag requires a single argument" % token.contents[0] + raise template.TemplateSyntaxError, "%r tag requires a single argument" % token.contents.split()[0] if not (format_string[0] == format_string[-1] and format_string[0] in ('"', "'")): raise template.TemplateSyntaxError, "%r tag's argument should be in quotes" % tag_name return CurrentTimeNode(format_string[1:-1]) @@ -846,7 +846,7 @@ Now your tag should begin to look like this:: # split_contents() knows not to split quoted strings. tag_name, date_to_be_formatted, format_string = token.split_contents() except ValueError: - raise template.TemplateSyntaxError, "%r tag requires exactly two arguments" % token.contents[0] + raise template.TemplateSyntaxError, "%r tag requires exactly two arguments" % token.contents.split()[0] if not (format_string[0] == format_string[-1] and format_string[0] in ('"', "'")): raise template.TemplateSyntaxError, "%r tag's argument should be in quotes" % tag_name return FormatTimeNode(date_to_be_formatted, format_string[1:-1]) @@ -1080,7 +1080,7 @@ class, like so:: # Splitting by None == splitting by spaces. tag_name, arg = token.contents.split(None, 1) except ValueError: - raise template.TemplateSyntaxError, "%r tag requires arguments" % token.contents[0] + raise template.TemplateSyntaxError, "%r tag requires arguments" % token.contents.split()[0] m = re.search(r'(.*?) as (\w+)', arg) if not m: raise template.TemplateSyntaxError, "%r tag had invalid arguments" % tag_name |
