1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Refs #27546 -- Removed hardcoded class names in __repr__() methods.

This commit is contained in:
Mads Jensen 2017-02-04 10:11:26 +01:00 committed by Tim Graham
parent ce69a421f6
commit 86ae1d51ed
4 changed files with 6 additions and 9 deletions

View File

@ -42,7 +42,7 @@ class Node:
return str(self.key)
def __repr__(self):
return '<Node: (%r, %r)>' % self.key
return '<%s: (%r, %r)>' % (self.__class__.__name__, self.key[0], self.key[1])
def add_child(self, child):
self.children.add(child)
@ -81,9 +81,6 @@ class DummyNode(Node):
self.origin = origin
self.error_message = error_message
def __repr__(self):
return '<DummyNode: (%r, %r)>' % self.key
def promote(self):
"""
Transition dummy to a normal node and clean off excess attribs.

View File

@ -278,7 +278,7 @@ class IfEqualNode(Node):
self.negate = negate
def __repr__(self):
return "<IfEqualNode>"
return '<%s>' % self.__class__.__name__
def render(self, context):
val1 = self.var1.resolve(context, True)
@ -294,7 +294,7 @@ class IfNode(Node):
self.conditions_nodelists = conditions_nodelists
def __repr__(self):
return "<IfNode>"
return '<%s>' % self.__class__.__name__
def __iter__(self):
for _, nodelist in self.conditions_nodelists:
@ -518,7 +518,7 @@ class WithNode(Node):
self.extra_context[name] = var
def __repr__(self):
return "<WithNode>"
return '<%s>' % self.__class__.__name__
def render(self, context):
values = {key: val.resolve(context) for key, val in self.extra_context.items()}

View File

@ -93,7 +93,7 @@ class ExtendsNode(Node):
self.blocks = {n.name: n for n in nodelist.get_nodes_by_type(BlockNode)}
def __repr__(self):
return '<ExtendsNode: extends %s>' % self.parent_name.token
return '<%s: extends %s>' % (self.__class__.__name__, self.parent_name.token)
def find_template(self, template_name, context):
"""

View File

@ -29,7 +29,7 @@ class LocalizeNode(Node):
self.use_l10n = use_l10n
def __repr__(self):
return "<LocalizeNode>"
return '<%s>' % self.__class__.__name__
def render(self, context):
old_setting = context.use_l10n