Tiny logic tightening in core.template.loader -- taken from new-admin

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1347 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-11-22 05:11:14 +00:00
parent 7911173ccc
commit 8a2d9fc2f4
1 changed files with 2 additions and 2 deletions

View File

@ -186,14 +186,14 @@ def do_extends(parser, token):
This tag may be used in two ways: ``{% extends "base" %}`` (with quotes) This tag may be used in two ways: ``{% extends "base" %}`` (with quotes)
uses the literal value "base" as the name of the parent template to extend, uses the literal value "base" as the name of the parent template to extend,
or ``{% entends variable %}`` uses the value of ``variable`` as the name or ``{% extends variable %}`` uses the value of ``variable`` as the name
of the parent template to extend. of the parent template to extend.
""" """
bits = token.contents.split() bits = token.contents.split()
if len(bits) != 2: if len(bits) != 2:
raise TemplateSyntaxError, "'%s' takes one argument" % bits[0] raise TemplateSyntaxError, "'%s' takes one argument" % bits[0]
parent_name, parent_name_var = None, None parent_name, parent_name_var = None, None
if (bits[1].startswith('"') and bits[1].endswith('"')) or (bits[1].startswith("'") and bits[1].endswith("'")): if bits[1][0] in ('"', "'") and bits[1][-1] == bits[1][0]:
parent_name = bits[1][1:-1] parent_name = bits[1][1:-1]
else: else:
parent_name_var = bits[1] parent_name_var = bits[1]