Changeset 6459
- Timestamp:
- 10/06/07 17:34:48 (1 year ago)
- Files:
-
- django/branches/newforms-admin (modified) (1 prop)
- django/branches/newforms-admin/AUTHORS (modified) (3 diffs)
- django/branches/newforms-admin/django/bin/compile-messages.py (modified) (1 diff)
- django/branches/newforms-admin/django/bin/make-messages.py (modified) (1 diff)
- django/branches/newforms-admin/django/conf/locale/de/LC_MESSAGES/django.mo (modified) (previous)
- django/branches/newforms-admin/django/conf/locale/de/LC_MESSAGES/django.po (modified) (2 diffs)
- django/branches/newforms-admin/django/contrib/auth/backends.py (modified) (1 diff)
- django/branches/newforms-admin/django/contrib/sessions/models.py (modified) (1 diff)
- django/branches/newforms-admin/django/core/handlers/wsgi.py (modified) (3 diffs)
- django/branches/newforms-admin/django/core/management/commands/startapp.py (modified) (1 diff)
- django/branches/newforms-admin/django/core/management/__init__.py (modified) (1 diff)
- django/branches/newforms-admin/django/db/models/fields/__init__.py (modified) (1 diff)
- django/branches/newforms-admin/django/http/__init__.py (modified) (1 diff)
- django/branches/newforms-admin/django/newforms/widgets.py (modified) (8 diffs)
- django/branches/newforms-admin/django/oldforms/__init__.py (modified) (2 diffs)
- django/branches/newforms-admin/django/utils/cache.py (modified) (5 diffs)
- django/branches/newforms-admin/django/utils/translation/__init__.py (modified) (4 diffs)
- django/branches/newforms-admin/django/utils/translation/trans_null.py (modified) (1 diff)
- django/branches/newforms-admin/django/utils/translation/trans_real.py (modified) (1 diff)
- django/branches/newforms-admin/django/views/static.py (modified) (1 diff)
- django/branches/newforms-admin/docs/databases.txt (modified) (1 diff)
- django/branches/newforms-admin/docs/email.txt (modified) (1 diff)
- django/branches/newforms-admin/docs/install.txt (modified) (2 diffs)
- django/branches/newforms-admin/docs/newforms.txt (modified) (1 diff)
- django/branches/newforms-admin/tests/modeltests/basic/models.py (modified) (1 diff)
- django/branches/newforms-admin/tests/modeltests/field_defaults/models.py (modified) (1 diff)
- django/branches/newforms-admin/tests/regressiontests/i18n/models.py (modified) (1 diff)
- django/branches/newforms-admin/tests/regressiontests/i18n/tests.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/newforms-admin
- Property svnmerge-integrated changed from /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6390,6392-6416 to /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6390,6392-6456
django/branches/newforms-admin/AUTHORS
r6417 r6459 116 116 A. Murat Eren <meren@pardus.org.tr> 117 117 Ludvig Ericson <ludvig.ericson@gmail.com> 118 eriks@win.tue.nl 118 119 Dirk Eschler <dirk.eschler@gmx.net> 119 120 Marc Fargas <telenieko@telenieko.com> … … 240 241 pavithran s <pavithran.s@gmail.com> 241 242 Barry Pederson <bp@barryp.org> 243 permonik@mesias.brnonet.cz 242 244 petr.marhoun@gmail.com 243 245 pgross@thoughtworks.com … … 318 320 Milton Waddams 319 321 wam-djangobug@wamber.net 320 wangchun <yaohua2000@gmail.com>322 Wang Chun <wangchun@exoweb.net> 321 323 Filip Wasilewski <filip.wasilewski@gmail.com> 322 324 Dan Watson <http://theidioteque.net/> django/branches/newforms-admin/django/bin/compile-messages.py
r6371 r6459 15 15 if os.environ.get('DJANGO_SETTINGS_MODULE'): 16 16 from django.conf import settings 17 basedirs += settings.LOCALE_PATHS 17 if hasattr(settings, 'LOCALE_PATHS'): 18 basedirs += settings.LOCALE_PATHS 18 19 19 20 # Gather existing directories. django/branches/newforms-admin/django/bin/make-messages.py
r5918 r6459 75 75 os.unlink(potfile) 76 76 77 all_files = [] 77 78 for (dirpath, dirnames, filenames) in os.walk("."): 78 for file in filenames: 79 if domain == 'djangojs' and file.endswith('.js'): 80 if verbose: sys.stdout.write('processing file %s in %s\n' % (file, dirpath)) 79 all_files.extend([(dirpath, f) for f in filenames]) 80 all_files.sort() 81 for dirpath, file in all_files: 82 if domain == 'djangojs' and file.endswith('.js'): 83 if verbose: sys.stdout.write('processing file %s in %s\n' % (file, dirpath)) 84 src = open(os.path.join(dirpath, file), "rb").read() 85 src = pythonize_re.sub('\n#', src) 86 open(os.path.join(dirpath, '%s.py' % file), "wb").write(src) 87 thefile = '%s.py' % file 88 cmd = 'xgettext %s -d %s -L Perl --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % ( 89 os.path.exists(potfile) and '--omit-header' or '', domain, os.path.join(dirpath, thefile)) 90 (stdin, stdout, stderr) = os.popen3(cmd, 't') 91 msgs = stdout.read() 92 errors = stderr.read() 93 if errors: 94 print "errors happened while running xgettext on %s" % file 95 print errors 96 sys.exit(8) 97 old = '#: '+os.path.join(dirpath, thefile)[2:] 98 new = '#: '+os.path.join(dirpath, file)[2:] 99 msgs = msgs.replace(old, new) 100 if msgs: 101 open(potfile, 'ab').write(msgs) 102 os.unlink(os.path.join(dirpath, thefile)) 103 elif domain == 'django' and (file.endswith('.py') or file.endswith('.html')): 104 thefile = file 105 if file.endswith('.html'): 81 106 src = open(os.path.join(dirpath, file), "rb").read() 82 src = pythonize_re.sub('\n#', src)83 open(os.path.join(dirpath, '%s.py' % file), "wb").write(src)84 107 thefile = '%s.py' % file 85 cmd = 'xgettext %s -d %s -L Perl --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % ( 86 os.path.exists(potfile) and '--omit-header' or '', domain, os.path.join(dirpath, thefile)) 87 (stdin, stdout, stderr) = os.popen3(cmd, 't') 88 msgs = stdout.read() 89 errors = stderr.read() 90 if errors: 91 print "errors happened while running xgettext on %s" % file 92 print errors 93 sys.exit(8) 108 open(os.path.join(dirpath, thefile), "wb").write(templatize(src)) 109 if verbose: 110 sys.stdout.write('processing file %s in %s\n' % (file, dirpath)) 111 cmd = 'xgettext -d %s -L Python --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --keyword=ugettext_noop --keyword=ugettext_lazy --keyword=ungettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % ( 112 domain, os.path.join(dirpath, thefile)) 113 (stdin, stdout, stderr) = os.popen3(cmd, 't') 114 msgs = stdout.read() 115 errors = stderr.read() 116 if errors: 117 print "errors happened while running xgettext on %s" % file 118 print errors 119 sys.exit(8) 120 if thefile != file: 94 121 old = '#: '+os.path.join(dirpath, thefile)[2:] 95 122 new = '#: '+os.path.join(dirpath, file)[2:] 96 123 msgs = msgs.replace(old, new) 97 if msgs: 98 open(potfile, 'ab').write(msgs) 124 if os.path.exists(potfile): 125 # Strip the header 126 msgs = '\n'.join(dropwhile(len, msgs.split('\n'))) 127 else: 128 msgs = msgs.replace('charset=CHARSET', 'charset=UTF-8') 129 if msgs: 130 open(potfile, 'ab').write(msgs) 131 if thefile != file: 99 132 os.unlink(os.path.join(dirpath, thefile)) 100 elif domain == 'django' and (file.endswith('.py') or file.endswith('.html')):101 thefile = file102 if file.endswith('.html'):103 src = open(os.path.join(dirpath, file), "rb").read()104 thefile = '%s.py' % file105 open(os.path.join(dirpath, thefile), "wb").write(templatize(src))106 if verbose:107 sys.stdout.write('processing file %s in %s\n' % (file, dirpath))108 cmd = 'xgettext -d %s -L Python --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --keyword=ugettext_noop --keyword=ugettext_lazy --keyword=ungettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % (109 domain, os.path.join(dirpath, thefile))110 (stdin, stdout, stderr) = os.popen3(cmd, 't')111 msgs = stdout.read()112 errors = stderr.read()113 if errors:114 print "errors happened while running xgettext on %s" % file115 print errors116 sys.exit(8)117 if thefile != file:118 old = '#: '+os.path.join(dirpath, thefile)[2:]119 new = '#: '+os.path.join(dirpath, file)[2:]120 msgs = msgs.replace(old, new)121 if os.path.exists(potfile):122 # Strip the header123 msgs = '\n'.join(dropwhile(len, msgs.split('\n')))124 else:125 msgs = msgs.replace('charset=CHARSET', 'charset=UTF-8')126 if msgs:127 open(potfile, 'ab').write(msgs)128 if thefile != file:129 os.unlink(os.path.join(dirpath, thefile))130 133 131 134 if os.path.exists(potfile): django/branches/newforms-admin/django/conf/locale/de/LC_MESSAGES/django.po
r5918 r6459 1 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 2 # This file is distributed under the same license as the PACKAGE package. 3 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. 1 # Translation of django.po to German 2 # 3 # Copyright (C) 2005-2007, 4 # This file is distributed under the same license as the django package. 4 5 # 5 6 msgid "" … … 1630 1631 msgstr "Webseiten" 1631 1632 1632 #: contrib/humanize/templatetags/humanize.py: 171633 #: contrib/humanize/templatetags/humanize.py:20 1633 1634 msgid "th" 1634 msgstr " "1635 1636 #: contrib/humanize/templatetags/humanize.py: 171635 msgstr "." 1636 1637 #: contrib/humanize/templatetags/humanize.py:20 1637 1638 msgid "st" 1638 msgstr " "1639 1640 #: contrib/humanize/templatetags/humanize.py: 171639 msgstr "." 1640 1641 #: contrib/humanize/templatetags/humanize.py:20 1641 1642 msgid "nd" 1642 msgstr " "1643 1644 #: contrib/humanize/templatetags/humanize.py: 171643 msgstr "." 1644 1645 #: contrib/humanize/templatetags/humanize.py:20 1645 1646 msgid "rd" 1646 msgstr " "1647 1648 #: contrib/humanize/templatetags/humanize.py: 471647 msgstr "." 1648 1649 #: contrib/humanize/templatetags/humanize.py:50 1649 1650 #, python-format 1650 1651 msgid "%(value).1f million" 1651 1652 msgid_plural "%(value).1f million" 1652 msgstr[0] " "1653 msgstr[1] " "1654 1655 #: contrib/humanize/templatetags/humanize.py:5 01653 msgstr[0] "%(value).1f Million" 1654 msgstr[1] "%(value).1f Millionen" 1655 1656 #: contrib/humanize/templatetags/humanize.py:53 1656 1657 #, python-format 1657 1658 msgid "%(value).1f billion" 1658 1659 msgid_plural "%(value).1f billion" 1659 msgstr[0] " "1660 msgstr[1] " "1661 1662 #: contrib/humanize/templatetags/humanize.py:5 31660 msgstr[0] "%(value).1f Milliarde" 1661 msgstr[1] "%(value).1f Milliarden" 1662 1663 #: contrib/humanize/templatetags/humanize.py:56 1663 1664 #, python-format 1664 1665 msgid "%(value).1f trillion" 1665 1666 msgid_plural "%(value).1f trillion" 1666 msgstr[0] " "1667 msgstr[1] " "1668 1669 #: contrib/humanize/templatetags/humanize.py: 681667 msgstr[0] "%(value).1f Billion" 1668 msgstr[1] "%(value).1f Billionen" 1669 1670 #: contrib/humanize/templatetags/humanize.py:71 1670 1671 msgid "one" 1671 1672 msgstr "ein" 1672 1673 1673 #: contrib/humanize/templatetags/humanize.py: 681674 #: contrib/humanize/templatetags/humanize.py:71 1674 1675 msgid "two" 1675 1676 msgstr "zwei" 1676 1677 1677 #: contrib/humanize/templatetags/humanize.py: 681678 #: contrib/humanize/templatetags/humanize.py:71 1678 1679 msgid "three" 1679 1680 msgstr "drei" 1680 1681 1681 #: contrib/humanize/templatetags/humanize.py: 681682 #: contrib/humanize/templatetags/humanize.py:71 1682 1683 msgid "four" 1683 1684 msgstr "vier" 1684 1685 1685 #: contrib/humanize/templatetags/humanize.py: 681686 #: contrib/humanize/templatetags/humanize.py:71 1686 1687 msgid "five" 1687 1688 msgstr "fünf" 1688 1689 1689 #: contrib/humanize/templatetags/humanize.py: 681690 #: contrib/humanize/templatetags/humanize.py:71 1690 1691 msgid "six" 1691 1692 msgstr "sechs" 1692 1693 1693 #: contrib/humanize/templatetags/humanize.py: 681694 #: contrib/humanize/templatetags/humanize.py:71 1694 1695 msgid "seven" 1695 1696 msgstr "sieben" 1696 1697 1697 #: contrib/humanize/templatetags/humanize.py: 681698 #: contrib/humanize/templatetags/humanize.py:71 1698 1699 msgid "eight" 1699 1700 msgstr "acht" 1700 1701 1701 #: contrib/humanize/templatetags/humanize.py: 681702 #: contrib/humanize/templatetags/humanize.py:71 1702 1703 msgid "nine" 1703 1704 msgstr "neun" django/branches/newforms-admin/django/contrib/auth/backends.py
r6417 r6459 2 2 from django.contrib.auth.models import User 3 3 4 try: 5 set 6 except NameError: 7 from sets import Set as set # Python 2.3 fallback 8 4 9 class ModelBackend: 5 10 """ django/branches/newforms-admin/django/contrib/sessions/models.py
r6371 r6459 1 import base64, md5, random, sys, datetime 1 import os 2 import sys 3 import time 4 import datetime 5 import base64 6 import md5 7 import random 2 8 import cPickle as pickle 9 3 10 from django.db import models 4 11 from django.utils.translation import ugettext_lazy as _ django/branches/newforms-admin/django/core/handlers/wsgi.py
r6342 r6459 1 from threading import Lock 2 from pprint import pformat 3 try: 4 from cStringIO import StringIO 5 except ImportError: 6 from StringIO import StringIO 7 1 8 from django.core.handlers.base import BaseHandler 2 9 from django.core import signals … … 5 12 from django.utils.encoding import force_unicode 6 13 from django import http 7 from pprint import pformat8 from shutil import copyfileobj9 from threading import Lock10 try:11 from cStringIO import StringIO12 except ImportError:13 from StringIO import StringIO14 14 15 15 # See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html … … 106 106 107 107 def is_secure(self): 108 return 'HTTPS' in self.environ and self.environ['HTTPS'] == 'on' 108 return 'wsgi.url_scheme' in self.environ \ 109 and self.environ['wsgi.url_scheme'] == 'https' 109 110 110 111 def _load_post_and_files(self): django/branches/newforms-admin/django/core/management/commands/startapp.py
r5918 r6459 17 17 # Determine the project_name a bit naively -- by looking at the name of 18 18 # the parent directory. 19 project_dir = os.path.normpath(os.path.join(directory, '..'))19 project_dir = os.path.normpath(os.path.join(directory, os.pardir)) 20 20 parent_dir = os.path.basename(project_dir) 21 21 project_name = os.path.basename(directory) django/branches/newforms-admin/django/core/management/__init__.py
r6417 r6459 240 240 project_name = os.path.basename(project_directory) 241 241 settings_name = os.path.splitext(settings_filename)[0] 242 sys.path.append(os.path.join(project_directory, '..'))242 sys.path.append(os.path.join(project_directory, os.pardir)) 243 243 project_module = __import__(project_name, {}, {}, ['']) 244 244 sys.path.pop() django/branches/newforms-admin/django/db/models/fields/__init__.py
r6417 r6459 237 237 if callable(self.default): 238 238 return self.default() 239 return self.default239 return force_unicode(self.default, strings_only=True) 240 240 if not self.empty_strings_allowed or (self.null and settings.DATABASE_ENGINE != 'oracle'): 241 241 return None django/branches/newforms-admin/django/http/__init__.py
r6458 r6459 48 48 "Returns the HTTP host using the environment or request headers." 49 49 # We try three options, in order of decreasing preference. 50 host = self.META.get('HTTP_X_FORWARDED_HOST', '') 51 if 'HTTP_HOST' in self.META: 50 if 'HTTP_X_FORWARDED_HOST' in self.META: 51 host = self.META['HTTP_X_FORWARDED_HOST'] 52 elif 'HTTP_HOST' in self.META: 52 53 host = self.META['HTTP_HOST'] 53 54 else: django/branches/newforms-admin/django/newforms/widgets.py
r6342 r6459 8 8 from sets import Set as set # Python 2.3 fallback 9 9 10 import copy 10 11 from itertools import chain 11 12 from django.conf import settings … … 136 137 self.attrs = {} 137 138 139 def __deepcopy__(self, memo): 140 obj = copy.copy(self) 141 obj.attrs = self.attrs.copy() 142 memo[id(self)] = obj 143 return obj 144 138 145 def render(self, name, value, attrs=None): 139 146 """ … … 192 199 193 200 def __init__(self, attrs=None, render_value=True): 194 s elf.attrs = attrs or {}201 super(PasswordInput, self).__init__(attrs) 195 202 self.render_value = render_value 196 203 … … 209 216 """ 210 217 def __init__(self, attrs=None, choices=()): 218 super(MultipleHiddenInput, self).__init__(attrs) 211 219 # choices can be any iterable 212 self.attrs = attrs or {}213 220 self.choices = choices 214 221 … … 249 256 class CheckboxInput(Widget): 250 257 def __init__(self, attrs=None, check_test=bool): 258 super(CheckboxInput, self).__init__(attrs) 251 259 # check_test is a callable that takes a value and returns True 252 260 # if the checkbox should be checked for that value. 253 self.attrs = attrs or {}254 261 self.check_test = check_test 255 262 … … 268 275 class Select(Widget): 269 276 def __init__(self, attrs=None, choices=()): 270 s elf.attrs = attrs or {}277 super(Select, self).__init__(attrs) 271 278 # choices can be any iterable, but we may need to render this widget 272 279 # multiple times. Thus, collapse it into a list so it can be consumed … … 307 314 class SelectMultiple(Widget): 308 315 def __init__(self, attrs=None, choices=()): 316 super(SelectMultiple, self).__init__(attrs) 309 317 # choices can be any iterable 310 self.attrs = attrs or {}311 318 self.choices = choices 312 319 … … 531 538 return [value.date(), value.time()] 532 539 return [None, None] 533 django/branches/newforms-admin/django/oldforms/__init__.py
r6417 r6459 501 501 if smart_unicode(value) == str_data: 502 502 selected_html = u' selected="selected"' 503 output.append(u' <option value="%s"%s>%s</option>' % (escape(value), selected_html, escape(display_name)))503 output.append(u' <option value="%s"%s>%s</option>' % (escape(value), selected_html, force_unicode(escape(display_name)))) 504 504 output.append(u' </select>') 505 505 return u'\n'.join(output) … … 613 613 if smart_unicode(value) in str_data_list: 614 614 selected_html = u' selected="selected"' 615 output.append(u' <option value="%s"%s>%s</option>' % (escape(value), selected_html, escape(choice)))615 output.append(u' <option value="%s"%s>%s</option>' % (escape(value), selected_html, force_unicode(escape(choice)))) 616 616 output.append(u' </select>') 617 617 return u'\n'.join(output) django/branches/newforms-admin/django/utils/cache.py
r6342 r6459 24 24 from django.conf import settings 25 25 from django.core.cache import cache 26 from django.utils.encoding import smart_str 26 from django.utils.encoding import smart_str, iri_to_uri 27 27 28 28 cc_delim_re = re.compile(r'\s*,\s*') … … 58 58 else: 59 59 cc = {} 60 61 # If there's already a max-age header but we're being asked to set a new 62 # max-age, use the minumum of the two ages. In practice this happens when 63 # a decorator and a piece of middleware both operate on a given view. 64 if 'max-age' in cc and 'max_age' in kwargs: 65 kwargs['max_age'] = min(cc['max-age'], kwargs['max_age']) 66 60 67 for (k,v) in kwargs.items(): 61 68 cc[k.replace('_', '-')] = v … … 119 126 if value is not None: 120 127 ctx.update(value) 121 return 'views.decorators.cache.cache_page.%s.%s.%s' % (key_prefix, request.path, ctx.hexdigest())128 return 'views.decorators.cache.cache_page.%s.%s.%s' % (key_prefix, iri_to_uri(request.path), ctx.hexdigest()) 122 129 123 130 def get_cache_key(request, key_prefix=None): … … 133 140 if key_prefix is None: 134 141 key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX 135 cache_key = 'views.decorators.cache.cache_header.%s.%s' % (key_prefix, request.path)142 cache_key = 'views.decorators.cache.cache_header.%s.%s' % (key_prefix, iri_to_uri(request.path)) 136 143 headerlist = cache.get(cache_key, None) 137 144 if headerlist is not None: … … 157 164 if cache_timeout is None: 158 165 cache_timeout = settings.CACHE_MIDDLEWARE_SECONDS 159 cache_key = 'views.decorators.cache.cache_header.%s.%s' % (key_prefix, request.path)166 cache_key = 'views.decorators.cache.cache_header.%s.%s' % (key_prefix, iri_to_uri(request.path)) 160 167 if response.has_header('Vary'): 161 168 headerlist = ['HTTP_'+header.upper().replace('-', '_') for header in vary_delim_re.split(response['Vary'])] django/branches/newforms-admin/django/utils/translation/__init__.py
r5627 r6459 3 3 """ 4 4 from django.utils.functional import lazy 5 from django.utils.encoding import force_unicode 5 6 6 7 __all__ = ['gettext', 'gettext_noop', 'gettext_lazy', 'ngettext', … … 40 41 41 42 # Make the originally requested function call on the way out the door. 42 return g[ caller](*args, **kwargs)43 return g['real_%s' % caller](*args, **kwargs) 43 44 44 45 g = globals() … … 64 65 return real_ungettext(singular, plural, number) 65 66 66 def string_concat(*strings):67 return real_string_concat(*strings)68 69 67 ngettext_lazy = lazy(ngettext, str) 70 68 gettext_lazy = lazy(gettext, str) 71 69 ungettext_lazy = lazy(ungettext, unicode) 72 70 ugettext_lazy = lazy(ugettext, unicode) 73 string_concat = lazy(string_concat, unicode)74 71 75 72 def activate(language): … … 109 106 return real_deactivate_all() 110 107 108 def string_concat(*strings): 109 """ 110 Lazy variant of string concatenation, needed for translations that are 111 constructed from multiple parts. 112 """ 113 return u''.join([force_unicode(s) for s in strings]) 114 string_concat = lazy(string_concat, unicode) django/branches/newforms-admin/django/utils/translation/trans_null.py
r5627 r6459 14 14 return force_unicode(ngettext(singular, plural, number)) 15 15 16 string_concat = lambda *strings: u''.join([force_unicode(el) for el in strings])17 16 activate = lambda x: None 18 17 deactivate = deactivate_all = install = lambda: None django/branches/newforms-admin/django/utils/translation/trans_real.py
r6342 r6459 517 517 return out.getvalue() 518 518 519 def string_concat(*strings):520 """"521 Lazy variant of string concatenation, needed for translations that are522 constructed from multiple parts.523 """524 return u''.join([force_unicode(s) for s in strings])django/branches/newforms-admin/django/views/static.py
r4265 r6459 30 30 for part in path.split('/'): 31 31 if not part: 32 # strip empty path components32 # Strip empty path components. 33 33 continue 34 34 drive, part = os.path.splitdrive(part) 35 35 head, part = os.path.split(part) 36 36 if part in (os.curdir, os.pardir): 37 # strip '.' amd '..' in path37 # Strip '.' and '..' in path. 38 38 continue 39 39 newpath = os.path.join(newpath, part).replace('\\', '/') django/branches/newforms-admin/docs/databases.txt
r6342 r6459 164 164 .. _AlterModelOnSyncDB: http://code.djangoproject.com/wiki/AlterModelOnSyncDB 165 165 166 167 Oracle Notes 168 ============ 169 170 Django supports `Oracle Database Server`_ versions 9i and higher. Oracle 171 version 10g or later is required to use Django's ``regex`` and ``iregex`` query 172 operators. You will also need the `cx_Oracle`_ driver, version 4.3.1 or newer. 173 174 .. _`Oracle Database Server`: http://www.oracle.com/ 175 .. _`cx_Oracle`: http://cx-oracle.sourceforge.net/ 176 177 To run ``python manage.py syncdb``, you'll need to create an Oracle database 178 user with CREATE TABLE, CREATE SEQUENCE, CREATE PROCEDURE, and CREATE TRIGGER 179 privileges. To run Django's test suite, the user also needs 180 CREATE and DROP DATABASE and CREATE and DROP TABLESPACE privileges. 181 182 Connecting to the Database 183 -------------------------- 184 185 Your Django settings.py file should look something like this for Oracle:: 186 187 DATABASE_ENGINE = 'oracle' 188 DATABASE_NAME = 'xe' 189 DATABASE_USER = 'a_user' 190 DATABASE_PASSWORD = 'a_password' 191 DATABASE_HOST = '' 192 DATABASE_PORT = '' 193 194 If you don't use a ``tnsnames.ora`` file or a similar naming method that 195 recognizes the SID ("xe" in this example), then fill in both ``DATABASE_HOST`` 196 and ``DATABASE_PORT`` like so:: 197 198 DATABASE_ENGINE = 'oracle' 199 DATABASE_NAME = 'xe' 200 DATABASE_USER = 'a_user' 201 DATABASE_PASSWORD = 'a_password' 202 DATABASE_HOST = 'dbprod01ned.mycompany.com' 203 DATABASE_PORT = '1540' 204 205 You should supply both ``DATABASE_HOST`` and ``DATABASE_PORT``, or leave both 206 as empty strings. 207 208 Tablespace Options 209 ------------------ 210 211 A common paradigm for optimizing performance in Oracle-based systems is the 212 use of `tablespaces`_ to organize disk layout. The Oracle backend supports 213 this use case by adding ``db_tablespace`` options to the ``Meta`` and 214 ``Field`` classes. (When using a backend that lacks support for tablespaces, 215 these options are ignored.) 216 217 .. _`tablespaces`: http://en.wikipedia.org/wiki/Tablespace 218 219 A tablespace can be specified for the table(s) generated by a model by 220 supplying the ``db_tablespace`` option inside the model's ``Meta`` class. 221 Additionally, the ``db_tablespace`` option can be passed to a ``Field`` 222 constructor to specify an alternate tablespace for the ``Field``'s column 223 index. If no index would be created for the column, the ``db_tablespace`` 224 option is ignored. 225 226 :: 227 228 class TablespaceExample(models.Model): 229 name = models.CharField(maxlength=30, db_index=True, db_tablespace="indexes") 230 data = models.CharField(maxlength=255, db_index=True) 231 edges = models.ManyToManyField(to="self", db_tablespace="indexes") 232 233 class Meta: 234 db_tablespace = "tables" 235 236 In this example, the tables generated by the ``TablespaceExample`` model 237 (i.e., the model table and the many-to-many table) would be stored in the 238 ``tables`` tablespace. The index for the name field and the indexes on the 239 many-to-many table would be stored in the ``indexes`` tablespace. The ``data`` 240 field would also generate an index, but no tablespace for it is specified, so 241 it would be stored in the model tablespace ``tables`` by default. 242 243 Django does not create the tablespaces for you. Please refer to `Oracle's 244 documentation`_ for details on creating and managing tablespaces. 245 246 .. _`Oracle's documentation`: http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7003.htm#SQLRF01403 247 248 Naming Issues 249 ------------- 250 251 Oracle imposes a name length limit of 30 characters. To accommodate this, the 252 backend truncates database identifiers to fit, replacing the final four 253 characters of the truncated name with a repeatable MD5 hash value. 254 255 NULL and Empty Strings 256 ---------------------- 257 258 Django generally prefers to use the empty string ('') rather than NULL, but 259 Oracle treats both identically. To get around this, the Oracle backend 260 coerces the ``null=True`` option on fields that permit the empty string as a 261 value. When fetching from the database, it is assumed that a NULL value in 262 one of these fields really means the empty string, and the data is silently 263 converted to reflect this assumption. 264 265 TextField Limitations 266 --------------------- 267 268 The Oracle backend stores ``TextFields`` as ``NCLOB`` columns. Oracle imposes 269 some limitations on the usage of such LOB columns in general: 270 271 * LOB columns may not be used as primary keys. 272 273 * LOB columns may not be used in indexes. 274 275 * LOB columns may not be used in a ``SELECT DISTINCT`` list. This means that 276 attempting to use the ``QuerySet.distinct`` method on a model that 277 includes ``TextField`` columns will result in an error when run against 278 Oracle. A workaround to this is to keep ``TextField`` columns out of any 279 models that you foresee performing ``.distinct`` queries on, and to 280 include the ``TextField`` in a related model instead. django/branches/newforms-admin/docs/email.txt
r6417 r6459 318 318 text_content = 'This is an important message.' 319 319 html_content = '<p>This is an <strong>important</strong> message.</p>' 320 msg = EmailMultiAlternatives(subject, text_content, from_email, to)320 msg = EmailMultiAlternatives(subject, text_content, from_email, [to]) 321 321 msg.attach_alternative(html_content, "text/html") 322 322 msg.send() django/branches/newforms-admin/docs/install.txt
r6371 r6459 67 67 68 68 * If you're using Oracle, you'll need cx_Oracle_, version 4.3.1 or higher. 69 You will also want to read the database-specific notes for the `Oracle backend`_. 69 70 70 71 If you plan to use Django's ``manage.py syncdb`` command to … … 89 90 .. _cx_Oracle: http://cx-oracle.sourceforge.net/ 90 91 .. _Oracle: http://www.oracle.com/ 92 .. _Oracle backend: ../databases/#oracle-notes 91 93 .. _testing framework: ../testing/ 92 94 django/branches/newforms-admin/docs/newforms.txt
r6417 r6459 2389 2389 2390 2390 That's all the documentation for now. For more, see the file 2391 http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms /tests.py2391 http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms 2392 2392 -- the unit tests for ``django.newforms``. This can give you a good idea of 2393 what's possible. 2393 what's possible. (Each submodule there contains separate tests.) 2394 2394 2395 2395 If you're really itching to learn and use this library, please be patient. django/branches/newforms-admin/tests/modeltests/basic/models.py
r6371 r6459 153 153 >>> a6.save() 154 154 >>> a6.headline 155 'Default headline'155 u'Default headline' 156 156 157 157 # For DateTimeFields, Django saves as much precision (in seconds) as you django/branches/newforms-admin/tests/modeltests/field_defaults/models.py
r5918 r6459 43 43 # Access database columns via Python attributes. 44 44 >>> a.headline 45 'Default headline'45 u'Default headline' 46 46 47 47 # make sure the two dates are sufficiently close django/branches/newforms-admin/tests/regressiontests/i18n/models.py
r5918 r6459 1 from django.db import models 2 from django.utils.translation import ugettext_lazy as _ 3 4 class TestModel(models.Model): 5 text = models.CharField(max_length=10, default=_('Anything')) 6 7 __test__ = {'API_TESTS': ''' 8 >>> tm = TestModel() 9 >>> tm.save() 10 ''' 11 } 12 django/branches/newforms-admin/tests/regressiontests/i18n/tests.py
r5918 r6459 31 31 >>> s == s4 32 32 False 33 34 unicode(string_concat(...)) should not raise a TypeError - #4796 35
