Changeset 6525
- Timestamp:
- 10/16/07 11:54:23 (9 months ago)
- Files:
-
- django/branches/gis (modified) (1 prop)
- django/branches/gis/AUTHORS (modified) (1 diff)
- django/branches/gis/django/bin/compile-messages.py (modified) (1 diff)
- django/branches/gis/django/bin/make-messages.py (modified) (1 diff)
- django/branches/gis/django/conf/locale/de/LC_MESSAGES/django.mo (modified) (previous)
- django/branches/gis/django/conf/locale/de/LC_MESSAGES/django.po (modified) (2 diffs)
- django/branches/gis/django/core/handlers/modpython.py (modified) (1 diff)
- django/branches/gis/django/core/handlers/wsgi.py (modified) (1 diff)
- django/branches/gis/django/core/management/base.py (modified) (5 diffs)
- django/branches/gis/django/core/management/color.py (modified) (2 diffs)
- django/branches/gis/django/core/management/commands/runserver.py (modified) (1 diff)
- django/branches/gis/django/core/management/commands/startapp.py (modified) (1 diff)
- django/branches/gis/django/core/management/__init__.py (modified) (1 diff)
- django/branches/gis/django/db/backends/postgresql/operations.py (modified) (1 diff)
- django/branches/gis/django/db/models/fields/__init__.py (modified) (1 diff)
- django/branches/gis/django/http/__init__.py (modified) (1 diff)
- django/branches/gis/django/newforms/widgets.py (modified) (7 diffs)
- django/branches/gis/django/oldforms/__init__.py (modified) (2 diffs)
- django/branches/gis/django/utils/datastructures.py (modified) (1 diff)
- django/branches/gis/django/utils/translation/__init__.py (modified) (4 diffs)
- django/branches/gis/django/utils/translation/trans_null.py (modified) (1 diff)
- django/branches/gis/django/utils/translation/trans_real.py (modified) (1 diff)
- django/branches/gis/django/views/static.py (modified) (3 diffs)
- django/branches/gis/docs/databases.txt (modified) (1 diff)
- django/branches/gis/docs/i18n.txt (modified) (1 diff)
- django/branches/gis/docs/newforms.txt (modified) (1 diff)
- django/branches/gis/docs/request_response.txt (modified) (1 diff)
- django/branches/gis/docs/templates_python.txt (modified) (1 diff)
- django/branches/gis/docs/unicode.txt (modified) (2 diffs)
- django/branches/gis/tests/modeltests/basic/models.py (modified) (1 diff)
- django/branches/gis/tests/modeltests/field_defaults/models.py (modified) (1 diff)
- django/branches/gis/tests/regressiontests/datastructures/tests.py (modified) (1 diff)
- django/branches/gis/tests/regressiontests/i18n/models.py (modified) (1 diff)
- django/branches/gis/tests/regressiontests/i18n/tests.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/gis
- Property svnmerge-integrated changed from /django/trunk:1-6441 to /django/trunk:1-6524
django/branches/gis/AUTHORS
r6442 r6525 314 314 Milton Waddams 315 315 wam-djangobug@wamber.net 316 wangchun <yaohua2000@gmail.com>316 Wang Chun <wangchun@exoweb.net> 317 317 Filip Wasilewski <filip.wasilewski@gmail.com> 318 318 Dan Watson <http://theidioteque.net/> django/branches/gis/django/bin/compile-messages.py
r6394 r6525 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/gis/django/bin/make-messages.py
r6018 r6525 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/gis/django/conf/locale/de/LC_MESSAGES/django.po
r6018 r6525 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/gis/django/core/handlers/modpython.py
r6394 r6525 15 15 def __init__(self, req): 16 16 self._req = req 17 self.path = force_unicode(req.uri )17 self.path = force_unicode(req.uri, errors='ignore') 18 18 19 19 def __repr__(self): django/branches/gis/django/core/handlers/wsgi.py
r6442 r6525 76 76 def __init__(self, environ): 77 77 self.environ = environ 78 self.path = force_unicode(environ['PATH_INFO'] )78 self.path = force_unicode(environ['PATH_INFO'], errors='ignore') 79 79 self.META = environ 80 80 self.method = environ['REQUEST_METHOD'].upper() django/branches/gis/django/core/management/base.py
r6442 r6525 1 import os 2 import sys 3 from optparse import make_option, OptionParser 4 1 5 import django 2 6 from django.core.exceptions import ImproperlyConfigured 3 7 from django.core.management.color import color_style 4 import itertools5 from optparse import make_option, OptionParser6 import sys7 import os8 8 9 9 class CommandError(Exception): … … 20 20 if options.pythonpath: 21 21 sys.path.insert(0, options.pythonpath) 22 22 23 23 class BaseCommand(object): 24 24 # Metadata about this command. … … 162 162 163 163 def handle(self, *args, **options): 164 from django.db import models 165 if len(args) != 0: 164 if args: 166 165 raise CommandError("Command doesn't accept any arguments") 167 168 166 return self.handle_noargs(**options) 169 167 … … 172 170 173 171 def copy_helper(style, app_or_project, name, directory, other_name=''): 174 import django 172 """ 173 Copies either a Django application layout template or a Django project 174 layout template into the specified directory. 175 176 * style - A color style object (see django.core.management.color). 177 * app_or_project - The string 'app' or 'project'. 178 * name - The name of the application or project. 179 * directory - The directory to copy the layout template to. 180 * other_name - When copying an application layout, this should be the name 181 of the project. 182 """ 175 183 import re 176 184 import shutil … … 222 230 new_permissions = stat.S_IMODE(st.st_mode) | stat.S_IWUSR 223 231 os.chmod(filename, new_permissions) 224 django/branches/gis/django/core/management/color.py
r6394 r6525 3 3 """ 4 4 5 from django.utils import termcolors6 5 import sys 7 6 7 from django.utils import termcolors 8 8 9 def color_style(): 9 "Returns a Style object with the Django color scheme." 10 if sys.platform == 'win32' or sys.platform == 'Pocket PC' or sys.platform.startswith('java') or not sys.stdout.isatty(): 10 """Returns a Style object with the Django color scheme.""" 11 if (sys.platform == 'win32' or sys.platform == 'Pocket PC' 12 or sys.platform.startswith('java') or not sys.stdout.isatty()): 11 13 return no_style() 12 14 class dummy: pass … … 22 24 23 25 def no_style(): 24 " Returns a Style object that has no colors."26 """Returns a Style object that has no colors.""" 25 27 class dummy: 26 28 def __getattr__(self, attr): django/branches/gis/django/core/management/commands/runserver.py
r6394 r6525 21 21 from django.core.servers.basehttp import run, AdminMediaHandler, WSGIServerException 22 22 from django.core.handlers.wsgi import WSGIHandler 23 if len(args) != 0:23 if args: 24 24 raise CommandError('Usage is runserver %s' % self.args) 25 25 if not addrport: django/branches/gis/django/core/management/commands/startapp.py
r6018 r6525 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/gis/django/core/management/__init__.py
r6442 r6525 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/gis/django/db/backends/postgresql/operations.py
r6021 r6525 101 101 style.SQL_KEYWORD('IS NOT'), 102 102 style.SQL_KEYWORD('FROM'), 103 style.SQL_TABLE( f.m2m_db_table())))103 style.SQL_TABLE(qn(f.m2m_db_table())))) 104 104 return output django/branches/gis/django/db/models/fields/__init__.py
r6394 r6525 239 239 if callable(self.default): 240 240 return self.default() 241 return self.default241 return force_unicode(self.default, strings_only=True) 242 242 if not self.empty_strings_allowed or (self.null and settings.DATABASE_ENGINE != 'oracle'): 243 243 return None django/branches/gis/django/http/__init__.py
r6394 r6525 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/gis/django/newforms/widgets.py
r6394 r6525 8 8 from sets import Set as set # Python 2.3 fallback 9 9 10 import copy 10 11 from itertools import chain 12 11 13 from django.utils.datastructures import MultiValueDict 12 14 from django.utils.html import escape … … 33 35 self.attrs = {} 34 36 37 def __deepcopy__(self, memo): 38 obj = copy.copy(self) 39 obj.attrs = self.attrs.copy() 40 memo[id(self)] = obj 41 return obj 42 35 43 def render(self, name, value, attrs=None): 36 44 """ … … 89 97 90 98 def __init__(self, attrs=None, render_value=True): 91 s elf.attrs = attrs or {}99 super(PasswordInput, self).__init__(attrs) 92 100 self.render_value = render_value 93 101 … … 106 114 """ 107 115 def __init__(self, attrs=None, choices=()): 116 super(MultipleHiddenInput, self).__init__(attrs) 108 117 # choices can be any iterable 109 self.attrs = attrs or {}110 118 self.choices = choices 111 119 … … 146 154 class CheckboxInput(Widget): 147 155 def __init__(self, attrs=None, check_test=bool): 156 super(CheckboxInput, self).__init__(attrs) 148 157 # check_test is a callable that takes a value and returns True 149 158 # if the checkbox should be checked for that value. 150 self.attrs = attrs or {}151 159 self.check_test = check_test 152 160 … … 165 173 class Select(Widget): 166 174 def __init__(self, attrs=None, choices=()): 167 s elf.attrs = attrs or {}175 super(Select, self).__init__(attrs) 168 176 # choices can be any iterable, but we may need to render this widget 169 177 # multiple times. Thus, collapse it into a list so it can be consumed … … 204 212 class SelectMultiple(Widget): 205 213 def __init__(self, attrs=None, choices=()): 214 super(SelectMultiple, self).__init__(attrs) 206 215 # choices can be any iterable 207 self.attrs = attrs or {}208 216 self.choices = choices 209 217 django/branches/gis/django/oldforms/__init__.py
r6394 r6525 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/gis/django/utils/datastructures.py
r6394 r6525 55 55 if data is None: data = {} 56 56 dict.__init__(self, data) 57 self.keyOrder = data.keys() 57 if isinstance(data, dict): 58 self.keyOrder = data.keys() 59 else: 60 self.keyOrder=[key for key, value in data] 58 61 59 62 def __setitem__(self, key, value): django/branches/gis/django/utils/translation/__init__.py
r6018 r6525 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/gis/django/utils/translation/trans_null.py
r6018 r6525 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/gis/django/utils/translation/trans_real.py
r6394 r6525 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/gis/django/views/static.py
r5540 r6525 1 from django.template import loader 2 from django.http import Http404, HttpResponse, HttpResponseRedirect, HttpResponseNotModified 3 from django.template import Template, Context, TemplateDoesNotExist 1 """ 2 Views and functions for serving static files. These are only to be used 3 during development, and SHOULD NOT be used in a production setting. 4 """ 5 4 6 import mimetypes 5 7 import os … … 9 11 import stat 10 12 import urllib 13 14 from django.template import loader 15 from django.http import Http404, HttpResponse, HttpResponseRedirect, HttpResponseNotModified 16 from django.template import Template, Context, TemplateDoesNotExist 11 17 12 18 def serve(request, path, document_root=None, show_indexes=False): … … 30 36 for part in path.split('/'): 31 37 if not part: 32 # strip empty path components38 # Strip empty path components. 33 39 continue 34 40 drive, part = os.path.splitdrive(part) 35 41 head, part = os.path.split(part) 36 42 if part in (os.curdir, os.pardir): 37 # strip '.' amd '..' in path43 # Strip '.' and '..' in path. 38 44 continue 39 45 newpath = os.path.join(newpath, part).replace('\\', '/') django/branches/gis/docs/databases.txt
r6442 r6525 176 176 177 177 To run ``python manage.py syncdb``, you'll need to create an Oracle database 178 user with CREATE TABLE, CREATE SEQUENCE, and CREATE PROCEDURE privileges. To179 run Django's test suite, the user also needs CREATE and DROP DATABASE and 180 CREATE and DROP TABLESPACE privileges.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 181 182 182 Connecting to the Database django/branches/gis/docs/i18n.txt
r6394 r6525 457 457 .. admonition:: Mind your charset 458 458 459 When creating a ``.po``file with your favorite text editor, first edit459 When creating a PO file with your favorite text editor, first edit 460 460 the charset line (search for ``"CHARSET"``) and set it to the charset 461 you'll be using to edit the content. Generally, utf-8 should work for most 462 languages, but ``gettext`` should handle any charset you throw at it. 461 you'll be using to edit the content. Due to the way the ``gettext`` tools 462 work internally and because we want to allow non-ASCII source strings in 463 Django's core and your applications, you **must** use UTF-8 as the encoding 464 for your PO file (this means that everybody will be using the same 465 encoding, which is important when Django processes the PO files). 463 466 464 467 To reexamine all source code and templates for new translation strings and django/branches/gis/docs/newforms.txt
r6442 r6525 2076 2076 2077 2077 That's all the documentation for now. For more, see the file 2078 http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms /tests.py2078 http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms 2079 2079 -- the unit tests for ``django.newforms``. This can give you a good idea of 2080 what's possible. 2080 what's possible. (Each submodule there contains separate tests.) 2081 2081 2082 2082 If you're really itching to learn and use this library, please be patient. django/branches/gis/docs/request_response.txt
r6394 r6525 382 382 but since this is actually the value included in the HTTP ``Content-Type`` 383 383 header, it can also include the character set encoding, which makes it 384 more than just a MIME type specification. If ``mimetype`` is specified i385 (not None), that value is used. Otherwise, ``content_type`` is used. If384 more than just a MIME type specification. If ``mimetype`` is specified 385 (not None), that value is used. Otherwise, ``content_type`` is used. If 386 386 neither is given, the ``DEFAULT_CONTENT_TYPE`` setting is used. 387 387 django/branches/gis/docs/templates_python.txt
r6442 r6525 317 317 return t.render(c) 318 318 319 Note::319 .. note:: 320 320 If you're using Django's ``render_to_response()`` shortcut to populate a 321 321 template with the contents of a dictionary, your template will be passed a django/branches/gis/docs/unicode.txt
r6018 r6525 111 111 for converting back and forth between Unicode and bytestrings. 112 112 113 * ``smart_unicode(s, encoding='utf-8', errors='strict')`` converts its 114 input to a Unicode string. The ``encoding`` parameter specifies the input 115 encoding. (For example, Django uses this internally when processing form 116 input data, which might not be UTF-8 encoded.) The ``errors`` parameter 117 takes any of the values that are accepted by Python's ``unicode()`` 118 function for its error handling. 113 * ``smart_unicode(s, encoding='utf-8', strings_only=False, errors='strict')`` 114 converts its input to a Unicode string. The ``encoding`` parameter 115 specifies the input encoding. (For example, Django uses this internally 116 when processing form input data, which might not be UTF-8 encoded.) The 117 ``strings_only`` parameter, if set to True, will result in Python 118 numbers, booleans and ``None`` not being converted to a string (they keep 119 their original types). The ``errors`` parameter takes any of the values 120 that are accepted by Python's ``unicode()`` function for its error 121 handling. 119 122 120 123 If you pass ``smart_unicode()`` an object that has a ``__unicode__`` 121 124 method, it will use that method to do the conversion. 122 125 123 * ``force_unicode(s, encoding='utf-8', errors='strict')`` is identical to124 ``smart_unicode()`` in almost all cases. The difference is when the125 first argument is a `lazy translation`_ instance. While126 * ``force_unicode(s, encoding='utf-8', strings_only=False, errors='strict')`` 127 is identical to ``smart_unicode()`` in almost all cases. The difference 128 is when the first argument is a `lazy translation`_ instance. While 126 129 ``smart_unicode()`` preserves lazy translations, ``force_unicode()`` 127 130 forces those objects to a Unicode string (causing the translation to … … 133 136 * ``smart_str(s, encoding='utf-8', strings_only=False, errors='strict')`` 134 137 is essentially the opposite of ``smart_unicode()``. It forces the first 135 argument to a bytestring. The ``strings_only`` parameter, if set to True, 136 will result in Python integers, booleans and ``None`` not being 137 converted to a string (they keep their original types). This is slightly 138 different semantics from Python's builtin ``str()`` function, but the 139 difference is needed in a few places within Django's internals. 138 argument to a bytestring. The ``strings_only`` parameter has the same 139 behaviour as for ``smart_unicode()`` and ``force_unicode()``. This is 140 slightly different semantics from Python's builtin ``str()`` function, 141 but the difference is needed in a few places within Django's internals. 140 142 141 143 Normally, you'll only need to use ``smart_unicode()``. Call it as early as django/branches/gis/tests/modeltests/basic/models.py
r6394 r6525 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/gis/tests/modeltests/field_defaults/models.py
r6018 r6525 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/gis/tests/regressiontests/datastructures/tests.py
r6018 r6525 56 56 {'one': 'not one', 'two': 'two', 'three': 'three'} 57 57 58
