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

Merged to trunk 1407

git-svn-id: http://code.djangoproject.com/svn/django/branches/new-admin@1408 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Robert Wittams 2005-11-25 00:09:46 +00:00
commit 32ca04e59e
12 changed files with 107 additions and 53 deletions

View File

@ -789,6 +789,7 @@ msgstr "Ihr Kennwort wurde ge
#: contrib/admin/templates/registration/password_reset_form.html:4 #: contrib/admin/templates/registration/password_reset_form.html:4
#: contrib/admin/templates/registration/password_reset_form.html:6 #: contrib/admin/templates/registration/password_reset_form.html:6
#: contrib/admin/templates/registration/password_reset_form.html:10
#: contrib/admin/templates/registration/password_reset_done.html:4 #: contrib/admin/templates/registration/password_reset_done.html:4
msgid "Password reset" msgid "Password reset"
msgstr "Kennwort zurücksetzen" msgstr "Kennwort zurücksetzen"
@ -1291,8 +1292,8 @@ msgid "password"
msgstr "Kennwort" msgstr "Kennwort"
#: models/auth.py:37 #: models/auth.py:37
msgid "Use '[algo]$[salt]$[hexdigest]" msgid "Use '[algo]$[salt]$[hexdigest]'"
msgstr "Im Format '[algo]$[salt]$[hexdigest]" msgstr "Im Format '[algo]$[salt]$[hexdigest]'"
#: models/auth.py:38 #: models/auth.py:38
msgid "staff status" msgid "staff status"

View File

@ -16,9 +16,39 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: contrib/redirects/models/redirects.py:7
msgid "redirect from"
msgstr "presmerovaný z"
#: contrib/redirects/models/redirects.py:8
msgid ""
"This should be an absolute path, excluding the domain name. Example: '/"
"events/search/'."
msgstr ""
"Tu by sa mala použiť absolútna cesta, bez domény. Napr.: '/events/search/'."
#: contrib/redirects/models/redirects.py:9
msgid "redirect to"
msgstr "presmerovaný na "
#: contrib/redirects/models/redirects.py:10
msgid ""
"This can be either an absolute path (as above) or a full URL starting with "
"'http://'."
msgstr ""
"Tu môže byť buď absolútna cesta (ako hore) alebo plné URL začínajúce s "
"'http://'."
#: contrib/redirects/models/redirects.py:12
msgid "redirect"
msgstr "presmerovanie"
#: contrib/redirects/models/redirects.py:13
msgid "redirects"
msgstr "presmerovania"
#: contrib/comments/models/comments.py:8 #: contrib/comments/models/comments.py:8
#: contrib/comments/models/comments.py:161 #: contrib/comments/models/comments.py:161
#, fuzzy
msgid "object ID" msgid "object ID"
msgstr "Ukáž objekt id" msgstr "Ukáž objekt id"
@ -28,9 +58,8 @@ msgstr "titulok"
#: contrib/comments/models/comments.py:10 #: contrib/comments/models/comments.py:10
#: contrib/comments/models/comments.py:162 #: contrib/comments/models/comments.py:162
#, fuzzy
msgid "comment" msgid "comment"
msgstr "obsah" msgstr "komentár"
#: contrib/comments/models/comments.py:11 #: contrib/comments/models/comments.py:11
msgid "rating #1" msgid "rating #1"
@ -79,7 +108,6 @@ msgid "is public"
msgstr "je zverejnený" msgstr "je zverejnený"
#: contrib/comments/models/comments.py:26 contrib/admin/views/doc.py:274 #: contrib/comments/models/comments.py:26 contrib/admin/views/doc.py:274
#, fuzzy
msgid "IP address" msgid "IP address"
msgstr "IP adresa" msgstr "IP adresa"
@ -100,13 +128,11 @@ msgid "Comment"
msgstr "Komentár" msgstr "Komentár"
#: contrib/comments/models/comments.py:32 #: contrib/comments/models/comments.py:32
#, fuzzy
msgid "Comments" msgid "Comments"
msgstr "Komentáre" msgstr "Komentáre"
#: contrib/comments/models/comments.py:85 #: contrib/comments/models/comments.py:85
#: contrib/comments/models/comments.py:204 #: contrib/comments/models/comments.py:204
#, fuzzy
msgid "Content object" msgid "Content object"
msgstr "Obsah objectu" msgstr "Obsah objectu"
@ -126,12 +152,10 @@ msgstr ""
"http://%(domain)s%(url)s" "http://%(domain)s%(url)s"
#: contrib/comments/models/comments.py:163 #: contrib/comments/models/comments.py:163
#, fuzzy
msgid "person's name" msgid "person's name"
msgstr "meno osoby" msgstr "meno osoby"
#: contrib/comments/models/comments.py:166 #: contrib/comments/models/comments.py:166
#, fuzzy
msgid "ip address" msgid "ip address"
msgstr "ip adresa" msgstr "ip adresa"
@ -140,12 +164,10 @@ msgid "approved by staff"
msgstr "schvalený za zamestnanca" msgstr "schvalený za zamestnanca"
#: contrib/comments/models/comments.py:172 #: contrib/comments/models/comments.py:172
#, fuzzy
msgid "Free comment" msgid "Free comment"
msgstr "Voľný komentár" msgstr "Voľný komentár"
#: contrib/comments/models/comments.py:173 #: contrib/comments/models/comments.py:173
#, fuzzy
msgid "Free comments" msgid "Free comments"
msgstr "Voľné komentáre" msgstr "Voľné komentáre"
@ -154,9 +176,8 @@ msgid "score"
msgstr "stav" msgstr "stav"
#: contrib/comments/models/comments.py:210 #: contrib/comments/models/comments.py:210
#, fuzzy
msgid "score date" msgid "score date"
msgstr "dátum konca platnosti" msgstr "údaje stavu"
#: contrib/comments/models/comments.py:213 #: contrib/comments/models/comments.py:213
msgid "Karma score" msgid "Karma score"
@ -172,17 +193,14 @@ msgid "%(score)d rating by %(user)s"
msgstr "%(score)d hodnotil %(user)s" msgstr "%(score)d hodnotil %(user)s"
#: contrib/comments/models/comments.py:248 #: contrib/comments/models/comments.py:248
#, fuzzy
msgid "flag date" msgid "flag date"
msgstr "návestie dátumu" msgstr "návestie dátumu"
#: contrib/comments/models/comments.py:251 #: contrib/comments/models/comments.py:251
#, fuzzy
msgid "User flag" msgid "User flag"
msgstr "Návestie uživateľa" msgstr "Návestie uživateľa"
#: contrib/comments/models/comments.py:252 #: contrib/comments/models/comments.py:252
#, fuzzy
msgid "User flags" msgid "User flags"
msgstr "Návestia užívateľa" msgstr "Návestia užívateľa"
@ -203,7 +221,6 @@ msgstr ""
"%(text)s" "%(text)s"
#: contrib/comments/models/comments.py:278 #: contrib/comments/models/comments.py:278
#, fuzzy
msgid "deletion date" msgid "deletion date"
msgstr "vymazaný dátum" msgstr "vymazaný dátum"
@ -225,7 +242,6 @@ msgid "Anonymous users cannot vote"
msgstr "Ak chcete hlasovať, najprv sa musíte prihlásiť" msgstr "Ak chcete hlasovať, najprv sa musíte prihlásiť"
#: contrib/comments/views/karma.py:22 #: contrib/comments/views/karma.py:22
#, fuzzy
msgid "Invalid comment ID" msgid "Invalid comment ID"
msgstr "Neplatný komentár ID" msgstr "Neplatný komentár ID"
@ -236,7 +252,7 @@ msgstr "Nemožete voliť vlastný príspevok"
#: contrib/comments/views/comments.py:25 #: contrib/comments/views/comments.py:25
msgid "" msgid ""
"This rating is required because you've entered at least one other rating." "This rating is required because you've entered at least one other rating."
msgstr "" msgstr "Toto hlasovanie je nevyhnutné, lebo súvisí s predchádzjúcou voľbou."
"Táto voľba je nevyhnutná nakoľko je pokračovaním vašej predchádzajúcej." "Táto voľba je nevyhnutná nakoľko je pokračovaním vašej predchádzajúcej."
#: contrib/comments/views/comments.py:109 #: contrib/comments/views/comments.py:109
@ -294,6 +310,8 @@ msgid ""
"The comment form had an invalid 'target' parameter -- the object ID was " "The comment form had an invalid 'target' parameter -- the object ID was "
"invalid" "invalid"
msgstr "Formulár kometára má chybný výstupný parameter -- objectID bol chybný" msgstr "Formulár kometára má chybný výstupný parameter -- objectID bol chybný"
"Formulár komentára ma chybný 'cieľový' parameter -- the objekt ID bol "
"poškodený"
#: contrib/comments/views/comments.py:254 #: contrib/comments/views/comments.py:254
#: contrib/comments/views/comments.py:318 #: contrib/comments/views/comments.py:318
@ -532,17 +550,14 @@ msgid "Comma-separated integers"
msgstr "Celé čísla oddelené čiarkami" msgstr "Celé čísla oddelené čiarkami"
#: contrib/admin/views/doc.py:266 #: contrib/admin/views/doc.py:266
#, fuzzy
msgid "Date (without time)" msgid "Date (without time)"
msgstr "Dátum (bez času)" msgstr "Dátum (bez času)"
#: contrib/admin/views/doc.py:267 #: contrib/admin/views/doc.py:267
#, fuzzy
msgid "Date (with time)" msgid "Date (with time)"
msgstr "Dátum (a čas)" msgstr "Dátum (a čas)"
#: contrib/admin/views/doc.py:268 #: contrib/admin/views/doc.py:268
#, fuzzy
msgid "E-mail address" msgid "E-mail address"
msgstr "E-mailová adresa" msgstr "E-mailová adresa"
@ -551,7 +566,6 @@ msgid "File path"
msgstr "Cesta k súboru" msgstr "Cesta k súboru"
#: contrib/admin/views/doc.py:270 #: contrib/admin/views/doc.py:270
#, fuzzy
msgid "Decimal number" msgid "Decimal number"
msgstr "Desiatkové číslo" msgstr "Desiatkové číslo"
@ -560,7 +574,6 @@ msgid "Boolean (Either True, False or None)"
msgstr "Boolean (Možné hodnoty sú True, False alebo None)" msgstr "Boolean (Možné hodnoty sú True, False alebo None)"
#: contrib/admin/views/doc.py:277 #: contrib/admin/views/doc.py:277
#, fuzzy
msgid "Phone number" msgid "Phone number"
msgstr "Číslo telefónu" msgstr "Číslo telefónu"
@ -576,10 +589,6 @@ msgstr "Text"
msgid "Time" msgid "Time"
msgstr "Čas" msgstr "Čas"
#: contrib/admin/views/doc.py:284 contrib/flatpages/models/flatpages.py:6
msgid "URL"
msgstr "URL"
#: contrib/admin/views/doc.py:285 #: contrib/admin/views/doc.py:285
msgid "U.S. state (two uppercase letters)" msgid "U.S. state (two uppercase letters)"
msgstr "U.S. štát (dve veľké písmená)" msgstr "U.S. štát (dve veľké písmená)"
@ -1306,7 +1315,7 @@ msgstr "priezvisko"
#: models/auth.py:36 #: models/auth.py:36
msgid "e-mail address" msgid "e-mail address"
msgstr "emailová adresa" msgstr "e-mailová adresa"
#: models/auth.py:37 #: models/auth.py:37
msgid "password" msgid "password"

View File

@ -7,7 +7,7 @@
{% block content %} {% block content %}
<h1>{% trans "Password reset") }}</h1> <h1>{% trans "Password reset") %}</h1>
<p>{% trans "Forgotten your password? Enter your e-mail address below, and we'll reset your password and e-mail the new one to you." %}</p> <p>{% trans "Forgotten your password? Enter your e-mail address below, and we'll reset your password and e-mail the new one to you." %}</p>

View File

@ -27,9 +27,12 @@ for app in INSTALLED_APPS:
# It won't change, so convert it to a tuple to save memory. # It won't change, so convert it to a tuple to save memory.
app_template_dirs = tuple(app_template_dirs) app_template_dirs = tuple(app_template_dirs)
def load_template_source(template_name, template_dirs=None): def get_template_sources(template_name, template_dirs=None):
for template_dir in app_template_dirs: for template_dir in app_template_dirs:
filepath = os.path.join(template_dir, template_name) + TEMPLATE_FILE_EXTENSION yield os.path.join(template_dir, template_name) + TEMPLATE_FILE_EXTENSION
def load_template_source(template_name, template_dirs=None):
for filepath in get_template_sources(template_name, template_dirs):
try: try:
return (open(filepath).read(), filepath) return (open(filepath).read(), filepath)
except IOError: except IOError:

View File

@ -4,12 +4,15 @@ from django.conf.settings import TEMPLATE_DIRS, TEMPLATE_FILE_EXTENSION
from django.core.template import TemplateDoesNotExist from django.core.template import TemplateDoesNotExist
import os import os
def load_template_source(template_name, template_dirs=None): def get_template_sources(template_name, template_dirs=None):
if not template_dirs: if not template_dirs:
template_dirs = TEMPLATE_DIRS template_dirs = TEMPLATE_DIRS
tried = []
for template_dir in template_dirs: for template_dir in template_dirs:
filepath = os.path.join(template_dir, template_name) + TEMPLATE_FILE_EXTENSION yield os.path.join(template_dir, template_name) + TEMPLATE_FILE_EXTENSION
def load_template_source(template_name, template_dirs=None):
tried = []
for filepath in get_template_sources(template_name, template_dirs):
try: try:
return (open(filepath).read(), filepath) return (open(filepath).read(), filepath)
except IOError: except IOError:

View File

@ -34,7 +34,7 @@ class User(meta.Model):
first_name = meta.CharField(_('first name'), maxlength=30, blank=True) first_name = meta.CharField(_('first name'), maxlength=30, blank=True)
last_name = meta.CharField(_('last name'), maxlength=30, blank=True) last_name = meta.CharField(_('last name'), maxlength=30, blank=True)
email = meta.EmailField(_('e-mail address'), blank=True) email = meta.EmailField(_('e-mail address'), blank=True)
password = meta.CharField(_('password'), maxlength=128, help_text=_("Use '[algo]$[salt]$[hexdigest]")) password = meta.CharField(_('password'), maxlength=128, help_text=_("Use '[algo]$[salt]$[hexdigest]'"))
is_staff = meta.BooleanField(_('staff status'), help_text=_("Designates whether the user can log into this admin site.")) is_staff = meta.BooleanField(_('staff status'), help_text=_("Designates whether the user can log into this admin site."))
is_active = meta.BooleanField(_('active'), default=True) is_active = meta.BooleanField(_('active'), default=True)
is_superuser = meta.BooleanField(_('superuser status')) is_superuser = meta.BooleanField(_('superuser status'))

View File

@ -364,12 +364,12 @@ endblock_re = re.compile(r"""^\s*endblocktrans$""")
plural_re = re.compile(r"""^\s*plural$""") plural_re = re.compile(r"""^\s*plural$""")
constant_re = re.compile(r"""_\(((?:".*?")|(?:'.*?'))\)""") constant_re = re.compile(r"""_\(((?:".*?")|(?:'.*?'))\)""")
def templateize(src): def templateize(src):
from django.core.template import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK
""" """
Turns a Django template into something that is understood by xgettext. It Turns a Django template into something that is understood by xgettext. It
does so by translating the Django translation tags into standard gettext does so by translating the Django translation tags into standard gettext
function invocations. function invocations.
""" """
from django.core.template import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK
out = StringIO() out = StringIO()
intrans = False intrans = False
inplural = False inplural = False

View File

@ -1,6 +1,6 @@
from django.conf import settings from django.conf import settings
from django.core.template import Template, Context from django.core.template import Template, Context, TemplateDoesNotExist
from django.utils.html import escape from django.utils.html import escape
from django.utils.httpwrappers import HttpResponseServerError, HttpResponseNotFound from django.utils.httpwrappers import HttpResponseServerError, HttpResponseNotFound
import inspect, os, re, sys import inspect, os, re, sys
@ -10,9 +10,10 @@ from os.path import dirname, join as pathjoin
HIDDEN_SETTINGS = re.compile('SECRET|PASSWORD') HIDDEN_SETTINGS = re.compile('SECRET|PASSWORD')
def linebreak_iter(template_source): def linebreak_iter(template_source):
yield 0
p = template_source.find('\n') p = template_source.find('\n')
while p >= 0: while p >= 0:
yield p yield p+1
p = template_source.find('\n', p+1) p = template_source.find('\n', p+1)
yield len(template_source) + 1 yield len(template_source) + 1
@ -23,19 +24,17 @@ def get_template_exception_info(exc_type, exc_value, tb):
line = 0 line = 0
upto = 0 upto = 0
source_lines = [] source_lines = []
linebreaks = izip(count(0), linebreak_iter(template_source)) for num, next in enumerate(linebreak_iter(template_source)):
linebreaks.next() # skip the nothing before initial line start
for num, next in linebreaks:
if start >= upto and end <= next: if start >= upto and end <= next:
line = num line = num
before = escape(template_source[upto:start]) before = escape(template_source[upto:start])
during = escape(template_source[start:end]) during = escape(template_source[start:end])
after = escape(template_source[end:next - 1]) after = escape(template_source[end:next])
source_lines.append( (num, escape(template_source[upto:next - 1])) ) source_lines.append( (num, escape(template_source[upto:next])) )
upto = next upto = next
total = len(source_lines) total = len(source_lines)
top = max(0, line - context_lines) top = max(1, line - context_lines)
bottom = min(total, line + 1 + context_lines) bottom = min(total, line + 1 + context_lines)
template_info = { template_info = {
@ -44,8 +43,8 @@ def get_template_exception_info(exc_type, exc_value, tb):
'before': before, 'before': before,
'during': during, 'during': during,
'after': after, 'after': after,
'top': top , 'top': top,
'bottom': bottom , 'bottom': bottom,
'total': total, 'total': total,
'line': line, 'line': line,
'name': origin.name, 'name': origin.name,
@ -59,6 +58,25 @@ def technical_500_response(request, exc_type, exc_value, tb):
the values returned from sys.exc_info() and friends. the values returned from sys.exc_info() and friends.
""" """
template_info = None template_info = None
template_does_not_exist = False
loader_debug_info = None
if issubclass(exc_type, TemplateDoesNotExist):
from django.core.template.loader import template_source_loaders
template_does_not_exist = True
loader_debug_info = []
for loader in template_source_loaders:
try:
source_list_func = getattr(__import__(loader.__module__, '', '', ['get_template_sources']), 'get_template_sources')
# NOTE: This assumes exc_value is the name of the template that
# the loader attempted to load.
template_list = [{'name': t, 'exists': os.path.exists(t)} \
for t in source_list_func(str(exc_value))]
except (ImportError, AttributeError):
template_list = []
loader_debug_info.append({
'loader': loader.__module__ + '.' + loader.__name__,
'templates': template_list,
})
if settings.TEMPLATE_DEBUG and hasattr(exc_value, 'source'): if settings.TEMPLATE_DEBUG and hasattr(exc_value, 'source'):
exc_type, exc_value, tb, template_info = get_template_exception_info(exc_type, exc_value, tb) exc_type, exc_value, tb, template_info = get_template_exception_info(exc_type, exc_value, tb)
frames = [] frames = []
@ -101,6 +119,8 @@ def technical_500_response(request, exc_type, exc_value, tb):
'request_protocol': os.environ.get("HTTPS") == "on" and "https" or "http", 'request_protocol': os.environ.get("HTTPS") == "on" and "https" or "http",
'settings': settings_dict, 'settings': settings_dict,
'template_info': template_info, 'template_info': template_info,
'template_does_not_exist': template_does_not_exist,
'loader_debug_info': loader_debug_info,
}) })
return HttpResponseServerError(t.render(c), mimetype='text/html') return HttpResponseServerError(t.render(c), mimetype='text/html')
@ -188,7 +208,8 @@ 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; } #template, #template-not-exist { background:#f6f6f6; }
#template-not-exist ul { margin: 0 0 0 20px; }
#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; }
@ -273,6 +294,23 @@ TECHNICAL_500_TEMPLATE = """
</tr> </tr>
</table> </table>
</div> </div>
{% if template_does_not_exist %}
<div id="template-not-exist">
<h2>Template-loader postmortem</h2>
{% if loader_debug_info %}
<p>Django tried loading these templates, in this order:</p>
<ul>
{% for loader in loader_debug_info %}
<li>Using loader <code>{{ loader.loader }}</code>:
<ul>{% for t in loader.templates %}<li><code>{{ t.name }}</code> (File {% if t.exists %}exists{% else %}does not exist{% endif %})</li>{% endfor %}</ul>
</li>
{% endfor %}
</ul>
{% else %}
<p>Django couldn't find any templates because your <code>TEMPLATE_LOADERS</code> setting is empty!</p>
{% endif %}
</div>
{% endif %}
{% if template_info %} {% if template_info %}
<div id="template"> <div id="template">
<h2>Template error</h2> <h2>Template error</h2>
@ -285,7 +323,7 @@ TECHNICAL_500_TEMPLATE = """
<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><th>{{ source_line.0 }}</th> <tr><th>{{ source_line.0 }}</th>
<td> {{ source_line.1 }}</td></tr> <td>{{ source_line.1 }}</td></tr>
{% endifequal %} {% endifequal %}
{% endfor %} {% endfor %}
</table> </table>

View File

@ -41,7 +41,7 @@ class PasswordResetForm(formfields.Manipulator):
'site_name': site_name, 'site_name': site_name,
'user': self.user_cache, 'user': self.user_cache,
} }
send_mail('Password reset on %s' % site_name, t.render(c), None, [self.user_cache.email]) send_mail('Password reset on %s' % site_name, t.render(Context(c)), None, [self.user_cache.email])
class PasswordChangeForm(formfields.Manipulator): class PasswordChangeForm(formfields.Manipulator):
"A form that lets a user change his password." "A form that lets a user change his password."

View File

@ -34,7 +34,7 @@ def serve(request, path, document_root=None, show_indexes=False):
if part in (os.curdir, os.pardir): if part in (os.curdir, os.pardir):
# strip '.' amd '..' in path # strip '.' amd '..' in path
continue continue
newpath = os.path.join(newpath, part) newpath = os.path.join(newpath, part).replace('\\', '/')
if newpath and path != newpath: if newpath and path != newpath:
return HttpResponseRedirect(newpath) return HttpResponseRedirect(newpath)
fullpath = os.path.join(document_root, newpath) fullpath = os.path.join(document_root, newpath)