Ticket #4021: 4021.diff

File 4021.diff, 3.8 KB (added by Ivan Sagalaev <Maniac@…>, 18 years ago)

Patch

  • django/conf/global_settings.py

     
    9595DEFAULT_CONTENT_TYPE = 'text/html'
    9696DEFAULT_CHARSET = 'utf-8'
    9797
     98# Charset of template files and initial sql files
     99FILE_CHARSET = 'utf-8'
     100
    98101# E-mail address that error messages come from.
    99102SERVER_EMAIL = 'root@localhost'
    100103
  • django/core/management.py

     
    545545                        print "Installing custom SQL for %s.%s model" % (app_name, model._meta.object_name)
    546546                    try:
    547547                        for sql in custom_sql:
    548                             cursor.execute(sql)
     548                            cursor.execute(sql.decode(settings.FILE_CHARSET))
    549549                    except Exception, e:
    550550                        sys.stderr.write("Failed to install custom SQL for %s.%s model: %s" % \
    551551                                            (app_name, model._meta.object_name, e))
     
    655655        try:
    656656            cursor = connection.cursor()
    657657            for sql in sql_list:
    658                 cursor.execute(sql)
     658                cursor.execute(sql.decode(settings.FILE_CHARSET))
    659659        except Exception, e:
    660660            sys.stderr.write(style.ERROR("""Error: %s couldn't be reset. Possible reasons:
    661661  * The database isn't running or isn't configured correctly.
     
    707707        try:
    708708            cursor = connection.cursor()
    709709            for sql in sql_list:
    710                 cursor.execute(sql)
     710                cursor.execute(sql.decode(settings.FILE_CHARSET))
    711711        except Exception, e:
    712712            sys.stderr.write(style.ERROR("""Error: Database %s couldn't be flushed. Possible reasons:
    713713  * The database isn't running or isn't configured correctly.
  • django/template/loaders/app_directories.py

     
    3434def load_template_source(template_name, template_dirs=None):
    3535    for filepath in get_template_sources(template_name, template_dirs):
    3636        try:
    37             return (open(filepath).read(), filepath)
     37            return (open(filepath).read().decode(settings.FILE_CHARSET), filepath)
    3838        except IOError:
    3939            pass
    4040    raise TemplateDoesNotExist, template_name
  • django/template/loaders/filesystem.py

     
    1414    tried = []
    1515    for filepath in get_template_sources(template_name, template_dirs):
    1616        try:
    17             return (open(filepath).read(), filepath)
     17            return (open(filepath).read().decode(settings.FILE_CHARSET), filepath)
    1818        except IOError:
    1919            tried.append(filepath)
    2020    if tried:
  • django/template/loaders/eggs.py

     
    1818        pkg_name = 'templates/' + template_name
    1919        for app in settings.INSTALLED_APPS:
    2020            try:
    21                 return (resource_string(app, pkg_name), 'egg:%s:%s ' % (app, pkg_name))
     21                return (resource_string(app, pkg_name), 'egg:%s:%s ' % (app, pkg_name)).decode(settings.FILE_CHARSET)
    2222            except:
    2323                pass
    2424    raise TemplateDoesNotExist, template_name
Back to Top