mirror of https://github.com/django/django.git
Fixed #27546 -- Removed hardcoded class names in __repr__() methods.
This commit is contained in:
parent
794b7d8033
commit
48826aa541
|
@ -46,7 +46,10 @@ class TranslatableFile(object):
|
||||||
self.locale_dir = locale_dir
|
self.locale_dir = locale_dir
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<TranslatableFile: %s>" % os.sep.join([self.dirpath, self.file])
|
return "<%s: %s>" % (
|
||||||
|
self.__class__.__name__,
|
||||||
|
os.sep.join([self.dirpath, self.file]),
|
||||||
|
)
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return self.path == other.path
|
return self.path == other.path
|
||||||
|
|
|
@ -198,8 +198,11 @@ class DeserializedObject(object):
|
||||||
self.m2m_data = m2m_data
|
self.m2m_data = m2m_data
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<DeserializedObject: %s(pk=%s)>" % (
|
return "<%s: %s(pk=%s)>" % (
|
||||||
self.object._meta.label, self.object.pk)
|
self.__class__.__name__,
|
||||||
|
self.object._meta.label,
|
||||||
|
self.object.pk,
|
||||||
|
)
|
||||||
|
|
||||||
def save(self, save_m2m=True, using=None, **kwargs):
|
def save(self, save_m2m=True, using=None, **kwargs):
|
||||||
# Call save on the Model baseclass directly. This bypasses any
|
# Call save on the Model baseclass directly. This bypasses any
|
||||||
|
|
|
@ -588,7 +588,7 @@ class ModelState(object):
|
||||||
raise ValueError("No index named %s on model %s" % (name, self.name))
|
raise ValueError("No index named %s on model %s" % (name, self.name))
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<ModelState: '%s.%s'>" % (self.app_label, self.name)
|
return "<%s: '%s.%s'>" % (self.__class__.__name__, self.app_label, self.name)
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -225,7 +225,7 @@ class QuerySet(object):
|
||||||
data = list(self[:REPR_OUTPUT_SIZE + 1])
|
data = list(self[:REPR_OUTPUT_SIZE + 1])
|
||||||
if len(data) > REPR_OUTPUT_SIZE:
|
if len(data) > REPR_OUTPUT_SIZE:
|
||||||
data[-1] = "...(remaining elements truncated)..."
|
data[-1] = "...(remaining elements truncated)..."
|
||||||
return '<QuerySet %r>' % data
|
return '<%s %r>' % (self.__class__.__name__, data)
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
self._fetch_all()
|
self._fetch_all()
|
||||||
|
@ -1220,7 +1220,7 @@ class RawQuerySet(object):
|
||||||
self.query.cursor.close()
|
self.query.cursor.close()
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<RawQuerySet: %s>" % self.query
|
return "<%s: %s>" % (self.__class__.__name__, self.query)
|
||||||
|
|
||||||
def __getitem__(self, k):
|
def __getitem__(self, k):
|
||||||
return list(self)[k]
|
return list(self)[k]
|
||||||
|
|
|
@ -86,7 +86,7 @@ class RawQuery(object):
|
||||||
return iter(result)
|
return iter(result)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<RawQuery: %s>" % self
|
return "<%s: %s>" % (self.__class__.__name__, self)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def params_type(self):
|
def params_type(self):
|
||||||
|
|
|
@ -55,7 +55,7 @@ class BaseConverter(object):
|
||||||
raise ValueError('Sign character found in converter base digits.')
|
raise ValueError('Sign character found in converter base digits.')
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<BaseConverter: base%s (%s)>" % (len(self.digits), self.digits)
|
return "<%s: base%s (%s)>" % (self.__class__.__name__, len(self.digits), self.digits)
|
||||||
|
|
||||||
def encode(self, i):
|
def encode(self, i):
|
||||||
neg, value = self.convert(i, self.decimal_digits, self.digits, '-')
|
neg, value = self.convert(i, self.decimal_digits, self.digits, '-')
|
||||||
|
|
Loading…
Reference in New Issue