[py3] Removed excessive usage of smart_bytes

This commit is contained in:
Claude Paroz 2012-08-15 12:09:59 +02:00
parent 814fde32d9
commit f8ea12f36b
2 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@ from django.core import signals
from django.core.handlers import base from django.core.handlers import base
from django.core.urlresolvers import set_script_prefix from django.core.urlresolvers import set_script_prefix
from django.utils import datastructures from django.utils import datastructures
from django.utils.encoding import force_text, smart_bytes, iri_to_uri from django.utils.encoding import force_text, smart_str, iri_to_uri
from django.utils.log import getLogger from django.utils.log import getLogger
logger = getLogger('django.request') logger = getLogger('django.request')
@ -246,5 +246,5 @@ class WSGIHandler(base.BaseHandler):
response_headers = [(str(k), str(v)) for k, v in response.items()] response_headers = [(str(k), str(v)) for k, v in response.items()]
for c in response.cookies.values(): for c in response.cookies.values():
response_headers.append((str('Set-Cookie'), str(c.output(header='')))) response_headers.append((str('Set-Cookie'), str(c.output(header=''))))
start_response(smart_bytes(status), response_headers) start_response(smart_str(status), response_headers)
return response return response

View File

@ -23,7 +23,7 @@ from django.db.models import signals
from django.db.models.loading import register_models, get_model from django.db.models.loading import register_models, get_model
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils.functional import curry from django.utils.functional import curry
from django.utils.encoding import smart_bytes, smart_str, force_text from django.utils.encoding import smart_str, force_text
from django.utils import six from django.utils import six
from django.utils.text import get_text_list, capfirst from django.utils.text import get_text_list, capfirst
@ -654,7 +654,7 @@ class Model(six.with_metaclass(ModelBase, object)):
raise ValueError("get_next/get_previous cannot be used on unsaved objects.") raise ValueError("get_next/get_previous cannot be used on unsaved objects.")
op = is_next and 'gt' or 'lt' op = is_next and 'gt' or 'lt'
order = not is_next and '-' or '' order = not is_next and '-' or ''
param = smart_bytes(getattr(self, field.attname)) param = force_text(getattr(self, field.attname))
q = Q(**{'%s__%s' % (field.name, op): param}) q = Q(**{'%s__%s' % (field.name, op): param})
q = q|Q(**{field.name: param, 'pk__%s' % op: self.pk}) q = q|Q(**{field.name: param, 'pk__%s' % op: self.pk})
qs = self.__class__._default_manager.using(self._state.db).filter(**kwargs).filter(q).order_by('%s%s' % (order, field.name), '%spk' % order) qs = self.__class__._default_manager.using(self._state.db).filter(**kwargs).filter(q).order_by('%s%s' % (order, field.name), '%spk' % order)