Ticket #19933: 19933-1.diff

File 19933-1.diff, 1.4 KB (added by Claude Paroz, 12 years ago)

Using DEFAULT_LOCALE_ENCODING

  • django/contrib/auth/management/__init__.py

    diff --git a/django/contrib/auth/management/__init__.py b/django/contrib/auth/management/__init__.py
    index 475dd25..6a8d5d3 100644
    a b from django.core.management.base import CommandError  
    1313from django.db import DEFAULT_DB_ALIAS, router
    1414from django.db.models import get_models, signals
    1515from django.utils import six
     16from django.utils.encoding import DEFAULT_LOCALE_ENCODING
    1617from django.utils.six.moves import input
    1718
    1819
    def get_system_username():  
    133134        # (a very restricted chroot environment, for example).
    134135        return ''
    135136    if not six.PY3:
    136         default_locale = locale.getdefaultlocale()[1]
    137         if not default_locale:
    138             return ''
    139137        try:
    140             result = result.decode(default_locale)
     138            result = result.decode(DEFAULT_LOCALE_ENCODING)
    141139        except UnicodeDecodeError:
    142140            # UnicodeDecodeError - preventive treatment for non-latin Windows.
    143141            return ''
  • django/utils/encoding.py

    diff --git a/django/utils/encoding.py b/django/utils/encoding.py
    index 68929cc..6c3a9de 100644
    a b def filepath_to_uri(path):  
    240240try:
    241241    DEFAULT_LOCALE_ENCODING = locale.getdefaultlocale()[1] or 'ascii'
    242242    codecs.lookup(DEFAULT_LOCALE_ENCODING)
    243 except:
     243except Exception:
    244244    DEFAULT_LOCALE_ENCODING = 'ascii'
Back to Top