1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

[py3] Made __repr__ return str with Python 3

This commit is contained in:
Claude Paroz
2012-08-12 20:36:43 +02:00
parent c1684e3dcb
commit dce34dc969
5 changed files with 17 additions and 15 deletions

View File

@@ -8,7 +8,7 @@ from io import BytesIO
from django.conf import settings
from django.core.files.base import File
from django.core.files import temp as tempfile
from django.utils.encoding import smart_bytes
from django.utils.encoding import smart_str
__all__ = ('UploadedFile', 'TemporaryUploadedFile', 'InMemoryUploadedFile',
'SimpleUploadedFile')
@@ -30,7 +30,7 @@ class UploadedFile(File):
self.charset = charset
def __repr__(self):
return smart_bytes("<%s: %s (%s)>" % (
return smart_str("<%s: %s (%s)>" % (
self.__class__.__name__, self.name, self.content_type))
def _get_name(self):

View File

@@ -14,7 +14,7 @@ from threading import local
from django.http import Http404
from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
from django.utils.datastructures import MultiValueDict
from django.utils.encoding import iri_to_uri, force_text, smart_bytes
from django.utils.encoding import iri_to_uri, force_text, smart_str
from django.utils.functional import memoize, lazy
from django.utils.importlib import import_module
from django.utils.module_loading import module_has_submodule
@@ -190,7 +190,7 @@ class RegexURLPattern(LocaleRegexProvider):
self.name = name
def __repr__(self):
return smart_bytes('<%s %s %s>' % (self.__class__.__name__, self.name, self.regex.pattern))
return smart_str('<%s %s %s>' % (self.__class__.__name__, self.name, self.regex.pattern))
def add_prefix(self, prefix):
"""
@@ -240,7 +240,9 @@ class RegexURLResolver(LocaleRegexProvider):
self._app_dict = {}
def __repr__(self):
return smart_bytes('<%s %s (%s:%s) %s>' % (self.__class__.__name__, self.urlconf_name, self.app_name, self.namespace, self.regex.pattern))
return smart_str('<%s %s (%s:%s) %s>' % (
self.__class__.__name__, self.urlconf_name, self.app_name,
self.namespace, self.regex.pattern))
def _populate(self):
lookups = MultiValueDict()