Ticket #440: 440.2.patch
File 440.2.patch, 2.5 KB (added by , 19 years ago) |
---|
-
utils/httpwrappers.py
1 1 from Cookie import SimpleCookie 2 2 from pprint import pformat 3 3 import datastructures 4 from django.conf import settings 4 5 5 6 DEFAULT_MIME_TYPE = 'text/html' 6 7 … … 131 132 "A basic HTTP response, with content and dictionary-accessed headers" 132 133 def __init__(self, content='', mimetype=DEFAULT_MIME_TYPE): 133 134 self.content = content 134 self.headers = {'Content-Type':mimetype }135 self.headers = {'Content-Type':mimetype + '; charset=' + settings.DEFAULT_CHARSET} 135 136 self.cookies = SimpleCookie() 136 137 self.status_code = 200 137 138 -
conf/project_template/settings/main.py
9 9 MANAGERS = ADMINS 10 10 11 11 LANGUAGE_CODE = 'en-us' 12 DEFAULT_CHARSET = 'utf-8' 12 13 13 14 DATABASE_ENGINE = 'postgresql' # 'postgresql', 'mysql', or 'sqlite3'. 14 15 DATABASE_NAME = '' # Or path to database file if using sqlite3. -
conf/settings.py
50 50 # move the time zone info into os.environ 51 51 os.environ['TZ'] = me.TIME_ZONE 52 52 53 # if charset is not set, use utf-8 54 if not hasattr(me, 'DEFAULT_CHARSET'): 55 me.DEFAULT_CHARSET='utf-8' 56 53 57 # finally, clean up my namespace 54 58 for k in dir(me): 55 59 if not k.startswith('_') and k != 'me' and k != k.upper(): -
core/formfields.py
2 2 from django.core.exceptions import PermissionDenied 3 3 from django.utils.html import escape 4 4 from django.utils.text import fix_microsoft_characters 5 from django.conf import settings 5 6 6 7 FORM_FIELD_ID_PREFIX = 'id_' 7 8 … … 222 223 self.validator_list = [self.isValidLength, self.hasNoNewlines] + validator_list 223 224 224 225 def isValidLength(self, data, form): 225 if data and self.maxlength and len(data ) > self.maxlength:226 if data and self.maxlength and len(data.decode(settings.DEFAULT_CHARSET)) > self.maxlength: 226 227 raise validators.ValidationError, "Ensure your text is less than %s characters." % self.maxlength 227 228 228 229 def hasNoNewlines(self, data, form):