diff --git a/django/contrib/contenttypes/views.py b/django/contrib/contenttypes/views.py
index ac0feff..c9bafd8 100644
a
|
b
|
from django import http
|
2 | 2 | from django.contrib.contenttypes.models import ContentType |
3 | 3 | from django.contrib.sites.models import Site, get_current_site |
4 | 4 | from django.core.exceptions import ObjectDoesNotExist |
| 5 | from django.utils.translation import ugettext as _ |
5 | 6 | |
6 | 7 | def shortcut(request, content_type_id, object_id): |
7 | 8 | "Redirect to an object's page based on a content-type ID and an object ID." |
… |
… |
def shortcut(request, content_type_id, object_id):
|
9 | 10 | try: |
10 | 11 | content_type = ContentType.objects.get(pk=content_type_id) |
11 | 12 | if not content_type.model_class(): |
12 | | raise http.Http404("Content type %s object has no associated model" % content_type_id) |
| 13 | raise http.Http404(_(u"Content type %s object has no associated model") % content_type_id) |
13 | 14 | obj = content_type.get_object_for_this_type(pk=object_id) |
14 | 15 | except (ObjectDoesNotExist, ValueError): |
15 | | raise http.Http404("Content type %s object %s doesn't exist" % (content_type_id, object_id)) |
| 16 | raise http.Http404(_(u"Content type %(type)s object %(id)s doesn't exist") % { |
| 17 | 'type': content_type_id, 'id': object_id}) |
16 | 18 | try: |
17 | 19 | absurl = obj.get_absolute_url() |
18 | 20 | except AttributeError: |
19 | | raise http.Http404("%s objects don't have get_absolute_url() methods" % content_type.name) |
| 21 | raise http.Http404(_(u"%s objects don't have get_absolute_url() methods") % content_type.name) |
20 | 22 | |
21 | 23 | # Try to figure out the object's domain, so we can do a cross-site redirect |
22 | 24 | # if necessary. |
diff --git a/django/contrib/gis/sitemaps/views.py b/django/contrib/gis/sitemaps/views.py
index eb2454c..3a9acad 100644
a
|
b
|
from django.contrib.gis.db.models.fields import GeometryField
|
7 | 7 | from django.db import connections, DEFAULT_DB_ALIAS |
8 | 8 | from django.db.models import get_model |
9 | 9 | from django.utils.encoding import smart_str |
| 10 | from django.utils.translation import ugettext as _ |
10 | 11 | |
11 | 12 | from django.contrib.gis.shortcuts import render_to_kml, render_to_kmz |
12 | 13 | |
… |
… |
def sitemap(request, sitemaps, section=None):
|
40 | 41 | maps, urls = [], [] |
41 | 42 | if section is not None: |
42 | 43 | if section not in sitemaps: |
43 | | raise Http404("No sitemap available for section: %r" % section) |
| 44 | raise Http404(_(u"No sitemap available for section: %r") % section) |
44 | 45 | maps.append(sitemaps[section]) |
45 | 46 | else: |
46 | 47 | maps = sitemaps.values() |
… |
… |
def sitemap(request, sitemaps, section=None):
|
54 | 55 | else: |
55 | 56 | urls.extend(site.get_urls(page=page, site=current_site)) |
56 | 57 | except EmptyPage: |
57 | | raise Http404("Page %s empty" % page) |
| 58 | raise Http404(_(u"Page %s empty") % page) |
58 | 59 | except PageNotAnInteger: |
59 | | raise Http404("No page '%s'" % page) |
| 60 | raise Http404(_(u"No page '%s'") % page) |
60 | 61 | xml = smart_str(loader.render_to_string('gis/sitemaps/geo_sitemap.xml', {'urlset': urls})) |
61 | 62 | return HttpResponse(xml, content_type='application/xml') |
62 | 63 | |
diff --git a/django/contrib/gis/views.py b/django/contrib/gis/views.py
index 0e17210..fc51a0b 100644
a
|
b
|
|
1 | 1 | from django.http import Http404 |
| 2 | from django.utils.translation import ugettext as _ |
2 | 3 | |
3 | 4 | def feed(request, url, feed_dict=None): |
4 | 5 | """Provided for backwards compatibility.""" |
5 | 6 | if not feed_dict: |
6 | | raise Http404("No feeds are registered.") |
| 7 | raise Http404(_(u"No feeds are registered.")) |
7 | 8 | |
8 | 9 | try: |
9 | 10 | slug, param = url.split('/', 1) |
… |
… |
def feed(request, url, feed_dict=None):
|
13 | 14 | try: |
14 | 15 | f = feed_dict[slug] |
15 | 16 | except KeyError: |
16 | | raise Http404("Slug %r isn't registered." % slug) |
| 17 | raise Http404(_(u"Slug %r isn't registered.") % slug) |
17 | 18 | |
18 | 19 | instance = f() |
19 | 20 | instance.feed_url = getattr(f, 'feed_url', None) or request.path |
diff --git a/django/views/static.py b/django/views/static.py
index 387b7da..f227980 100644
a
|
b
|
import urllib
|
14 | 14 | from django.http import Http404, HttpResponse, HttpResponseRedirect, HttpResponseNotModified |
15 | 15 | from django.template import loader, Template, Context, TemplateDoesNotExist |
16 | 16 | from django.utils.http import http_date, parse_http_date |
| 17 | from django.utils.translation import ugettext as _, ugettext_noop |
17 | 18 | |
18 | 19 | def serve(request, path, document_root=None, show_indexes=False): |
19 | 20 | """ |
… |
… |
def serve(request, path, document_root=None, show_indexes=False):
|
48 | 49 | if os.path.isdir(fullpath): |
49 | 50 | if show_indexes: |
50 | 51 | return directory_index(newpath, fullpath) |
51 | | raise Http404("Directory indexes are not allowed here.") |
| 52 | raise Http404(_(u"Directory indexes are not allowed here.")) |
52 | 53 | if not os.path.exists(fullpath): |
53 | | raise Http404('"%s" does not exist' % fullpath) |
| 54 | raise Http404(_(u'"%s" does not exist') % fullpath) |
54 | 55 | # Respect the If-Modified-Since header. |
55 | 56 | statobj = os.stat(fullpath) |
56 | 57 | mimetype, encoding = mimetypes.guess_type(fullpath) |
… |
… |
def serve(request, path, document_root=None, show_indexes=False):
|
69 | 70 | |
70 | 71 | |
71 | 72 | DEFAULT_DIRECTORY_INDEX_TEMPLATE = """ |
| 73 | {% load i18n %} |
72 | 74 | <!DOCTYPE html> |
73 | 75 | <html lang="en"> |
74 | 76 | <head> |
75 | 77 | <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> |
76 | 78 | <meta http-equiv="Content-Language" content="en-us" /> |
77 | 79 | <meta name="robots" content="NONE,NOARCHIVE" /> |
78 | | <title>Index of {{ directory }}</title> |
| 80 | <title>{% blocktrans %}Index of {{ directory }}{% endblocktrans %}</title> |
79 | 81 | </head> |
80 | 82 | <body> |
81 | | <h1>Index of {{ directory }}</h1> |
| 83 | <h1>{% blocktrans %}Index of {{ directory }}{% endblocktrans %}</h1> |
82 | 84 | <ul> |
83 | 85 | {% ifnotequal directory "/" %} |
84 | 86 | <li><a href="../">../</a></li> |
… |
… |
DEFAULT_DIRECTORY_INDEX_TEMPLATE = """
|
90 | 92 | </body> |
91 | 93 | </html> |
92 | 94 | """ |
| 95 | template_translatable = ugettext_noop(u"Index of %(directory)s") |
93 | 96 | |
94 | 97 | def directory_index(path, fullpath): |
95 | 98 | try: |