1
0
mirror of https://github.com/django/django.git synced 2025-07-04 09:49:12 +00:00

Merge to trunk r1381

git-svn-id: http://code.djangoproject.com/svn/django/branches/new-admin@1382 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Robert Wittams 2005-11-23 23:23:20 +00:00
commit f7d3e8a20d
11 changed files with 44 additions and 32 deletions

View File

@ -14,7 +14,12 @@ if os.path.isdir(os.path.join('conf', 'locale')):
elif os.path.isdir('locale'): elif os.path.isdir('locale'):
localedir = os.path.abspath('locale') localedir = os.path.abspath('locale')
else: 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) sys.exit(1)
(opts, args) = getopt.getopt(sys.argv[1:], 'l:d:va') (opts, args) = getopt.getopt(sys.argv[1:], 'l:d:va')

View File

@ -1177,8 +1177,8 @@ msgstr[1] "Tage"
#: utils/timesince.py:15 #: utils/timesince.py:15
msgid "hour" msgid "hour"
msgid_plural "hours" msgid_plural "hours"
msgstr[0] "" msgstr[0] "Stunde"
msgstr[1] "" msgstr[1] "Stunden"
#: utils/timesince.py:16 #: utils/timesince.py:16
msgid "minute" msgid "minute"

View File

@ -1191,7 +1191,6 @@ msgstr[0] "Tento mesiac"
msgstr[1] "Tento mesiac" msgstr[1] "Tento mesiac"
#: utils/timesince.py:14 #: utils/timesince.py:14
#, fuzzy
msgid "day" msgid "day"
msgid_plural "days" msgid_plural "days"
msgstr[0] "Dnes" msgstr[0] "Dnes"
@ -1200,15 +1199,14 @@ msgstr[1] "Dnes"
#: utils/timesince.py:15 #: utils/timesince.py:15
msgid "hour" msgid "hour"
msgid_plural "hours" msgid_plural "hours"
msgstr[0] "" msgstr[0] "hodina"
msgstr[1] "" msgstr[1] "hodín"
#: utils/timesince.py:16 #: utils/timesince.py:16
#, fuzzy
msgid "minute" msgid "minute"
msgid_plural "minutes" msgid_plural "minutes"
msgstr[0] "web" msgstr[0] "minúta"
msgstr[1] "web" msgstr[1] "minút"
#: models/core.py:7 #: models/core.py:7
msgid "domain name" msgid "domain name"
@ -1379,9 +1377,8 @@ msgid "Welsh"
msgstr "Waleský" msgstr "Waleský"
#: conf/global_settings.py:40 #: conf/global_settings.py:40
#, fuzzy
msgid "Danish" msgid "Danish"
msgstr "Španielsky" msgstr "Dánsky"
#: conf/global_settings.py:41 #: conf/global_settings.py:41
msgid "German" msgid "German"

View File

@ -22,7 +22,7 @@
{% else %} {% else %}
<th>{{ model.name }}</th> <th>{{ model.name }}</th>
{% endif %} {% endif %}
{{}}
{% if model.perms.add %} {% if model.perms.add %}
<td class="x50"><a href="{{ model.admin_url }}add/" class="addlink">{% trans 'Add' %}</a></td> <td class="x50"><a href="{{ model.admin_url }}add/" class="addlink">{% trans 'Add' %}</a></td>
{% else %} {% else %}

View File

@ -44,6 +44,7 @@ COMMENT_FORM = '''
''' '''
FREE_COMMENT_FORM = ''' FREE_COMMENT_FORM = '''
{% load i18n %}
{% if display_form %} {% if display_form %}
<form action="/comments/postfree/" method="post"> <form action="/comments/postfree/" method="post">
<p>{% trans "Your name:" %} <input type="text" id="id_person_name" name="person_name" /></p> <p>{% trans "Your name:" %} <input type="text" id="id_person_name" name="person_name" /></p>

View File

@ -7,7 +7,7 @@ a string) and returns a tuple in this format:
(view_function, dict_of_view_function_args) (view_function, dict_of_view_function_args)
""" """
from django.core.exceptions import Http404, ViewDoesNotExist from django.core.exceptions import Http404, ImproperlyConfigured, ViewDoesNotExist
import re import re
class Resolver404(Http404): class Resolver404(Http404):
@ -74,7 +74,11 @@ class RegexURLResolver(object):
try: try:
return self._urlconf_module return self._urlconf_module
except AttributeError: 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 return self._urlconf_module
urlconf_module = property(_get_urlconf_module) urlconf_module = property(_get_urlconf_module)

View File

@ -1,4 +1,4 @@
import datetime, time import datetime, math, time
from django.utils.tzinfo import LocalTimezone from django.utils.tzinfo import LocalTimezone
from django.utils.translation import ngettext from django.utils.translation import ngettext
@ -30,6 +30,8 @@ def timesince(d, now=None):
count = since / seconds count = since / seconds
if count != 0: if count != 0:
break break
if count < 0:
return '%d milliseconds' % math.floor(delta.microseconds / 1000)
s = '%d %s' % (count, name(count)) s = '%d %s' % (count, name(count))
if i + 1 < len(chunks): if i + 1 < len(chunks):
# Now get the second item # Now get the second item

View File

@ -1,3 +1,4 @@
from django.conf import settings from django.conf import settings
from django.core.template import Template, Context from django.core.template import Template, Context
from django.utils.html import escape from django.utils.html import escape
@ -172,6 +173,8 @@ TECHNICAL_500_TEMPLATE = """
table.vars td, table.req td { font-family:monospace; } table.vars td, table.req td { font-family:monospace; }
table td.code { width:100%; } table td.code { width:100%; }
table td.code div { overflow:hidden; } 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 { list-style-type:none; }
ul.traceback li.frame { margin-bottom:1em; } ul.traceback li.frame { margin-bottom:1em; }
div.context { margin: 10px 0; } div.context { margin: 10px 0; }
@ -184,14 +187,14 @@ TECHNICAL_500_TEMPLATE = """
#summary { background: #ffc; } #summary { background: #ffc; }
#summary h2 { font-weight: normal; color: #666; } #summary h2 { font-weight: normal; color: #666; }
#explanation { background:#eee; } #explanation { background:#eee; }
#template { background:#f6f6f6; }
#traceback { background:#eee; } #traceback { background:#eee; }
#requestinfo { background:#f6f6f6; padding-left:120px; } #requestinfo { background:#f6f6f6; padding-left:120px; }
#summary table { border:none; background:transparent; } #summary table { border:none; background:transparent; }
#requestinfo h2, #requestinfo h3 { position:relative; margin-left:-100px; } #requestinfo h2, #requestinfo h3 { position:relative; margin-left:-100px; }
#requestinfo h3 { margin-bottom:-1em; } #requestinfo h3 { margin-bottom:-1em; }
table.source td { font-family: monospace; white-space: pre; }
span.specific { background:#ffcab7; }
.error { background: #ffc; } .error { background: #ffc; }
.specific { color:#cc3300; font-weight:bold; }
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
//<!-- //<!--
@ -271,16 +274,16 @@ TECHNICAL_500_TEMPLATE = """
</div> </div>
{% if template_info %} {% if template_info %}
<div id="template"> <div id="template">
<h2>Template</h2> <h2>Template error</h2>
In template {{ template_info.name }}, error at line {{ template_info.line }} <p>In template <code>{{ template_info.name }}</code>, error at line <strong>{{ template_info.line }}</strong></p>
<div>{{ template_info.message|escape }}</div> <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 %}"> <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 %} {% for source_line in template_info.source_lines %}
{% ifequal source_line.0 template_info.line %} {% 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> <td>{{ template_info.before }}<span class="specific">{{ template_info.during }}</span>{{ template_info.after }}</td></tr>
{% else %} {% else %}
<tr><td>{{ source_line.0 }}</td> <tr><th>{{ source_line.0 }}</th>
<td> {{ source_line.1 }}</td></tr> <td> {{ source_line.1 }}</td></tr>
{% endifequal %} {% endifequal %}
{% endfor %} {% endfor %}

View File

@ -99,9 +99,9 @@ TEMPLATE_TESTS = {
# Chained filters, with an argument to the first one # Chained filters, with an argument to the first one
'basic-syntax29': ('{{ var|removetags:"b i"|upper|lower }}', {"var": "<b><i>Yes</i></b>"}, "yes"), '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'), 'basic-syntax30': (r"""{{ var|default_if_none:" endquote\" hah" }}""", {"var": None}, ' endquote" hah'),
### IF TAG ################################################################ ### IF TAG ################################################################
'if-tag01': ("{% if foo %}yes{% else %}no{% endif %}", {"foo": True}, "yes"), 'if-tag01': ("{% if foo %}yes{% else %}no{% endif %}", {"foo": True}, "yes"),
@ -232,19 +232,19 @@ TEMPLATE_TESTS = {
'multiline01': (""" 'multiline01': ("""
Hello, Hello,
boys. boys.
How How
are are
you you
gentlemen. gentlemen.
""", """,
{}, {},
""" """
Hello, Hello,
boys. boys.
How How
are are
you you
gentlemen. gentlemen.
""" ), """ ),
# simple translation of a string delimited by ' # simple translation of a string delimited by '
'i18n01': ("{% load i18n %}{% trans 'xxxyyyxxx' %}", {}, "xxxyyyxxx"), 'i18n01': ("{% load i18n %}{% trans 'xxxyyyxxx' %}", {}, "xxxyyyxxx"),