diff options
author | Robert Wittams <robert@wittams.com> | 2005-11-23 23:23:20 +0000 |
---|---|---|
committer | Robert Wittams <robert@wittams.com> | 2005-11-23 23:23:20 +0000 |
commit | f7d3e8a20d75d2b9db77b4400e0ac1bc7cee39d4 (patch) | |
tree | 8401b7a54e993adbae27d2f5a4738c05bed5c8c9 | |
parent | 9a47071c389151f069842214eb8f3c81b14b52ab (diff) | |
parent | 39eac9bdff25078b89845d94706523fdeec0a213 (diff) | |
download | django-f7d3e8a20d75d2b9db77b4400e0ac1bc7cee39d4.tar.gz |
Merge to trunk r1381
git-svn-id: http://code.djangoproject.com/svn/django/branches/new-admin@1382 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rwxr-xr-x | django/bin/make-messages.py | 7 | ||||
-rw-r--r-- | django/conf/locale/de/LC_MESSAGES/django.mo | bin | 30591 -> 45468 bytes | |||
-rw-r--r-- | django/conf/locale/de/LC_MESSAGES/django.po | 4 | ||||
-rw-r--r-- | django/conf/locale/sk/LC_MESSAGES/django.mo | bin | 26818 -> 39478 bytes | |||
-rw-r--r-- | django/conf/locale/sk/LC_MESSAGES/django.po | 13 | ||||
-rw-r--r-- | django/contrib/admin/templates/admin/index.html | 2 | ||||
-rw-r--r-- | django/contrib/comments/templatetags/comments.py | 1 | ||||
-rw-r--r-- | django/core/urlresolvers.py | 8 | ||||
-rw-r--r-- | django/utils/timesince.py | 4 | ||||
-rw-r--r-- | django/views/debug.py | 17 | ||||
-rw-r--r-- | tests/othertests/templates.py | 20 |
11 files changed, 44 insertions, 32 deletions
diff --git a/django/bin/make-messages.py b/django/bin/make-messages.py index ea4f76b4aa..c989034c0b 100755 --- a/django/bin/make-messages.py +++ b/django/bin/make-messages.py @@ -14,7 +14,12 @@ if os.path.isdir(os.path.join('conf', 'locale')): elif os.path.isdir('locale'): localedir = os.path.abspath('locale') else: - print "this script should be run from the django svn tree or your project or app tree" + print "This script should be run from the django svn tree or your project or app tree." + print "If you did indeed run it from the svn checkout or your project or application," + print "maybe you are just missing the conf/locale (in the django tree) or locale (for project" + print "and application) directory?" + print "make-messages.py doesn't create it automatically, you have to create it by hand if" + print "you want to enable i18n for your project or application." sys.exit(1) (opts, args) = getopt.getopt(sys.argv[1:], 'l:d:va') diff --git a/django/conf/locale/de/LC_MESSAGES/django.mo b/django/conf/locale/de/LC_MESSAGES/django.mo Binary files differindex 9e5635e753..8ae549045f 100644 --- a/django/conf/locale/de/LC_MESSAGES/django.mo +++ b/django/conf/locale/de/LC_MESSAGES/django.mo diff --git a/django/conf/locale/de/LC_MESSAGES/django.po b/django/conf/locale/de/LC_MESSAGES/django.po index 23fafdb9b2..96bc1a363f 100644 --- a/django/conf/locale/de/LC_MESSAGES/django.po +++ b/django/conf/locale/de/LC_MESSAGES/django.po @@ -1177,8 +1177,8 @@ msgstr[1] "Tage" #: utils/timesince.py:15 msgid "hour" msgid_plural "hours" -msgstr[0] "" -msgstr[1] "" +msgstr[0] "Stunde" +msgstr[1] "Stunden" #: utils/timesince.py:16 msgid "minute" diff --git a/django/conf/locale/sk/LC_MESSAGES/django.mo b/django/conf/locale/sk/LC_MESSAGES/django.mo Binary files differindex d7a59b6de2..26d18a6cec 100644 --- a/django/conf/locale/sk/LC_MESSAGES/django.mo +++ b/django/conf/locale/sk/LC_MESSAGES/django.mo diff --git a/django/conf/locale/sk/LC_MESSAGES/django.po b/django/conf/locale/sk/LC_MESSAGES/django.po index 0b36314088..27733aa393 100644 --- a/django/conf/locale/sk/LC_MESSAGES/django.po +++ b/django/conf/locale/sk/LC_MESSAGES/django.po @@ -1191,7 +1191,6 @@ msgstr[0] "Tento mesiac" msgstr[1] "Tento mesiac" #: utils/timesince.py:14 -#, fuzzy msgid "day" msgid_plural "days" msgstr[0] "Dnes" @@ -1200,15 +1199,14 @@ msgstr[1] "Dnes" #: utils/timesince.py:15 msgid "hour" msgid_plural "hours" -msgstr[0] "" -msgstr[1] "" +msgstr[0] "hodina" +msgstr[1] "hodín" #: utils/timesince.py:16 -#, fuzzy msgid "minute" msgid_plural "minutes" -msgstr[0] "web" -msgstr[1] "web" +msgstr[0] "minúta" +msgstr[1] "minút" #: models/core.py:7 msgid "domain name" @@ -1379,9 +1377,8 @@ msgid "Welsh" msgstr "Waleský" #: conf/global_settings.py:40 -#, fuzzy msgid "Danish" -msgstr "Španielsky" +msgstr "Dánsky" #: conf/global_settings.py:41 msgid "German" diff --git a/django/contrib/admin/templates/admin/index.html b/django/contrib/admin/templates/admin/index.html index 03ae272909..4b52d3e4d8 100644 --- a/django/contrib/admin/templates/admin/index.html +++ b/django/contrib/admin/templates/admin/index.html @@ -22,7 +22,7 @@ {% else %} <th>{{ model.name }}</th> {% endif %} - + {{}} {% if model.perms.add %} <td class="x50"><a href="{{ model.admin_url }}add/" class="addlink">{% trans 'Add' %}</a></td> {% else %} diff --git a/django/contrib/comments/templatetags/comments.py b/django/contrib/comments/templatetags/comments.py index 72c586e206..126009a5b9 100644 --- a/django/contrib/comments/templatetags/comments.py +++ b/django/contrib/comments/templatetags/comments.py @@ -44,6 +44,7 @@ COMMENT_FORM = ''' ''' FREE_COMMENT_FORM = ''' +{% load i18n %} {% if display_form %} <form action="/comments/postfree/" method="post"> <p>{% trans "Your name:" %} <input type="text" id="id_person_name" name="person_name" /></p> diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py index 2a0dda38b8..95cc914676 100644 --- a/django/core/urlresolvers.py +++ b/django/core/urlresolvers.py @@ -7,7 +7,7 @@ a string) and returns a tuple in this format: (view_function, dict_of_view_function_args) """ -from django.core.exceptions import Http404, ViewDoesNotExist +from django.core.exceptions import Http404, ImproperlyConfigured, ViewDoesNotExist import re class Resolver404(Http404): @@ -74,7 +74,11 @@ class RegexURLResolver(object): try: return self._urlconf_module except AttributeError: - self._urlconf_module = __import__(self.urlconf_name, '', '', ['']) + try: + self._urlconf_module = __import__(self.urlconf_name, '', '', ['']) + except ValueError, e: + # Invalid urlconf_name, such as "foo.bar." (note trailing period) + raise ImproperlyConfigured, "Error while importing URLconf %r: %s" % (self.urlconf_name, e) return self._urlconf_module urlconf_module = property(_get_urlconf_module) diff --git a/django/utils/timesince.py b/django/utils/timesince.py index b1df997e2e..89af456e96 100644 --- a/django/utils/timesince.py +++ b/django/utils/timesince.py @@ -1,4 +1,4 @@ -import datetime, time +import datetime, math, time from django.utils.tzinfo import LocalTimezone from django.utils.translation import ngettext @@ -30,6 +30,8 @@ def timesince(d, now=None): count = since / seconds if count != 0: break + if count < 0: + return '%d milliseconds' % math.floor(delta.microseconds / 1000) s = '%d %s' % (count, name(count)) if i + 1 < len(chunks): # Now get the second item diff --git a/django/views/debug.py b/django/views/debug.py index 012d7f9a75..3728dffa4a 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -1,3 +1,4 @@ + from django.conf import settings from django.core.template import Template, Context from django.utils.html import escape @@ -172,6 +173,8 @@ TECHNICAL_500_TEMPLATE = """ table.vars td, table.req td { font-family:monospace; } table td.code { width:100%; } table td.code div { overflow:hidden; } + table.source th { color:#666; } + table.source td { font-family:monospace; white-space:pre; border-bottom:1px solid #eee; } ul.traceback { list-style-type:none; } ul.traceback li.frame { margin-bottom:1em; } div.context { margin: 10px 0; } @@ -184,14 +187,14 @@ TECHNICAL_500_TEMPLATE = """ #summary { background: #ffc; } #summary h2 { font-weight: normal; color: #666; } #explanation { background:#eee; } + #template { background:#f6f6f6; } #traceback { background:#eee; } #requestinfo { background:#f6f6f6; padding-left:120px; } #summary table { border:none; background:transparent; } #requestinfo h2, #requestinfo h3 { position:relative; margin-left:-100px; } #requestinfo h3 { margin-bottom:-1em; } - table.source td { font-family: monospace; white-space: pre; } - span.specific { background:#ffcab7; } .error { background: #ffc; } + .specific { color:#cc3300; font-weight:bold; } </style> <script type="text/javascript"> //<!-- @@ -271,16 +274,16 @@ TECHNICAL_500_TEMPLATE = """ </div> {% if template_info %} <div id="template"> - <h2>Template</h2> - In template {{ template_info.name }}, error at line {{ template_info.line }} - <div>{{ template_info.message|escape }}</div> + <h2>Template error</h2> + <p>In template <code>{{ template_info.name }}</code>, error at line <strong>{{ template_info.line }}</strong></p> + <h3>{{ template_info.message|escape }}</h3> <table class="source{% if template_info.top %} cut-top{% endif %}{% ifnotequal template_info.bottom template_info.total %} cut-bottom{% endifnotequal %}"> {% for source_line in template_info.source_lines %} {% ifequal source_line.0 template_info.line %} - <tr class="error"><td>{{ source_line.0 }}</td> + <tr class="error"><th>{{ source_line.0 }}</th> <td>{{ template_info.before }}<span class="specific">{{ template_info.during }}</span>{{ template_info.after }}</td></tr> {% else %} - <tr><td>{{ source_line.0 }}</td> + <tr><th>{{ source_line.0 }}</th> <td> {{ source_line.1 }}</td></tr> {% endifequal %} {% endfor %} diff --git a/tests/othertests/templates.py b/tests/othertests/templates.py index b5a9df707a..b58f62cc8a 100644 --- a/tests/othertests/templates.py +++ b/tests/othertests/templates.py @@ -99,9 +99,9 @@ TEMPLATE_TESTS = { # Chained filters, with an argument to the first one 'basic-syntax29': ('{{ var|removetags:"b i"|upper|lower }}', {"var": "<b><i>Yes</i></b>"}, "yes"), - #Escaped string as argument + #Escaped string as argument 'basic-syntax30': (r"""{{ var|default_if_none:" endquote\" hah" }}""", {"var": None}, ' endquote" hah'), - + ### IF TAG ################################################################ 'if-tag01': ("{% if foo %}yes{% else %}no{% endif %}", {"foo": True}, "yes"), @@ -232,19 +232,19 @@ TEMPLATE_TESTS = { 'multiline01': (""" Hello, boys. - How - are + How + are you - gentlemen. - """, - {}, + gentlemen. + """, + {}, """ Hello, boys. - How - are + How + are you - gentlemen. + gentlemen. """ ), # simple translation of a string delimited by ' 'i18n01': ("{% load i18n %}{% trans 'xxxyyyxxx' %}", {}, "xxxyyyxxx"), |