mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
magic-removal: Merged to [2523]
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2524 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
bcacb8843e
commit
ff48a48b6a
1
AUTHORS
1
AUTHORS
@ -37,6 +37,7 @@ answer newbie questions, and generally made Django that much better:
|
||||
Arthur <avandorp@gmail.com>
|
||||
Jiri Barton
|
||||
Ned Batchelder <http://www.nedbatchelder.com/>
|
||||
Shannon -jj Behrens <http://jjinux.blogspot.com/>
|
||||
James Bennett
|
||||
Paul Bissex <http://e-scribe.com/>
|
||||
Simon Blanchard
|
||||
|
Binary file not shown.
@ -324,16 +324,16 @@ msgstr "等級 #1"
|
||||
#: contrib/comments/templates/comments/form.html:12
|
||||
#: contrib/comments/templates/comments/form.html:23
|
||||
msgid "Required"
|
||||
msgstr ""
|
||||
msgstr "必需的"
|
||||
|
||||
#: contrib/comments/templates/comments/form.html:12
|
||||
#: contrib/comments/templates/comments/form.html:23
|
||||
msgid "Optional"
|
||||
msgstr ""
|
||||
msgstr "可選擇的"
|
||||
|
||||
#: contrib/comments/templates/comments/form.html:23
|
||||
msgid "Post a photo"
|
||||
msgstr ""
|
||||
msgstr "張貼照片"
|
||||
|
||||
#: contrib/comments/templates/comments/form.html:27
|
||||
#: contrib/comments/templates/comments/freeform.html:5
|
||||
@ -486,7 +486,7 @@ msgstr "%(name)s \"%(obj)s\" 已成功新增。"
|
||||
|
||||
#: contrib/admin/views/main.py:415 contrib/admin/views/main.py:492
|
||||
msgid "You may edit it again below."
|
||||
msgstr "你可以在下面再次編輯。"
|
||||
msgstr "你可以在下面再編輯一次。"
|
||||
|
||||
#: contrib/admin/views/main.py:423 contrib/admin/views/main.py:501
|
||||
#, python-format
|
||||
@ -705,7 +705,7 @@ msgstr "DATE_WITH_TIME_FULL"
|
||||
msgid ""
|
||||
"This object doesn't have a change history. It probably wasn't added via this "
|
||||
"admin site."
|
||||
msgstr "這個物件沒有變更的歷蜜。它可能不是透過這個管理網站新增的。"
|
||||
msgstr "這個物件沒有變更的歷史。它可能不是透過這個管理網站新增的。"
|
||||
|
||||
#: contrib/admin/templates/admin/base_site.html:4
|
||||
msgid "Django site admin"
|
||||
@ -742,7 +742,7 @@ msgstr "找不到頁面"
|
||||
|
||||
#: contrib/admin/templates/admin/404.html:10
|
||||
msgid "We're sorry, but the requested page could not be found."
|
||||
msgstr "我們很抱歉,不過被要求的頁面找不到"
|
||||
msgstr "我們很抱歉,不過被要求的頁面找不到。"
|
||||
|
||||
#: contrib/admin/templates/admin/index.html:27
|
||||
#: contrib/admin/templates/admin/change_form.html:14
|
||||
@ -755,7 +755,7 @@ msgstr "變更"
|
||||
|
||||
#: contrib/admin/templates/admin/index.html:43
|
||||
msgid "You don't have permission to edit anything."
|
||||
msgstr "你沒有編輯任何東西的權限"
|
||||
msgstr "你沒有編輯任何東西的權限。"
|
||||
|
||||
#: contrib/admin/templates/admin/index.html:51
|
||||
msgid "Recent Actions"
|
||||
@ -776,7 +776,7 @@ msgstr "新增 %(name)s"
|
||||
|
||||
#: contrib/admin/templates/admin/login.html:20
|
||||
msgid "Have you <a href=\"/password_reset/\">forgotten your password</a>?"
|
||||
msgstr "你 <a href=\"/password_reset/\">忘記你的密碼了嗎</a>?"
|
||||
msgstr "你 <a href=\"/password_reset/\">忘記密碼了嗎</a>?"
|
||||
|
||||
#: contrib/admin/templates/admin/base.html:23
|
||||
msgid "Welcome,"
|
||||
@ -1083,7 +1083,7 @@ msgstr "內容"
|
||||
|
||||
#: contrib/flatpages/models/flatpages.py:10
|
||||
msgid "enable comments"
|
||||
msgstr "允許評論"
|
||||
msgstr "啟用評論"
|
||||
|
||||
#: contrib/flatpages/models/flatpages.py:11
|
||||
msgid "template name"
|
||||
@ -1127,31 +1127,31 @@ msgstr "TIME_FORMAT"
|
||||
|
||||
#: utils/dates.py:6
|
||||
msgid "Monday"
|
||||
msgstr "星期一"
|
||||
msgstr "週一"
|
||||
|
||||
#: utils/dates.py:6
|
||||
msgid "Tuesday"
|
||||
msgstr "星期二"
|
||||
msgstr "週二"
|
||||
|
||||
#: utils/dates.py:6
|
||||
msgid "Wednesday"
|
||||
msgstr "星期三"
|
||||
msgstr "週三"
|
||||
|
||||
#: utils/dates.py:6
|
||||
msgid "Thursday"
|
||||
msgstr "星期四"
|
||||
msgstr "週四"
|
||||
|
||||
#: utils/dates.py:6
|
||||
msgid "Friday"
|
||||
msgstr "星期五"
|
||||
msgstr "週五"
|
||||
|
||||
#: utils/dates.py:7
|
||||
msgid "Saturday"
|
||||
msgstr "星期六"
|
||||
msgstr "週六"
|
||||
|
||||
#: utils/dates.py:7
|
||||
msgid "Sunday"
|
||||
msgstr "星期日"
|
||||
msgstr "週日"
|
||||
|
||||
#: utils/dates.py:14
|
||||
msgid "January"
|
||||
@ -1305,7 +1305,7 @@ msgstr "內容型態"
|
||||
|
||||
#: models/core.py:67
|
||||
msgid "session key"
|
||||
msgstr "session 鍵"
|
||||
msgstr "session 鍵值"
|
||||
|
||||
#: models/core.py:68
|
||||
msgid "session data"
|
||||
@ -1459,11 +1459,11 @@ msgstr "義大利文"
|
||||
|
||||
#: conf/global_settings.py:48
|
||||
msgid "Japanese"
|
||||
msgstr ""
|
||||
msgstr "日文"
|
||||
|
||||
#: conf/global_settings.py:49
|
||||
msgid "Dutch"
|
||||
msgstr ""
|
||||
msgstr "荷蘭文"
|
||||
|
||||
#: conf/global_settings.py:50
|
||||
msgid "Norwegian"
|
||||
@ -1660,7 +1660,7 @@ msgstr "輸入有效的 U.S. 州名簡稱。"
|
||||
#, python-format
|
||||
msgid "Watch your mouth! The word %s is not allowed here."
|
||||
msgid_plural "Watch your mouth! The words %s are not allowed here."
|
||||
msgstr[0] "看住你的嘴!%s 不允許出現在這裡。"
|
||||
msgstr[0] "看管口舌!此處不允許 %s 這樣的字眼。"
|
||||
|
||||
#: core/validators.py:238
|
||||
#, python-format
|
||||
|
@ -1,11 +1,14 @@
|
||||
import os
|
||||
import urllib
|
||||
import posixpath
|
||||
import mimetypes
|
||||
from django.template import loader
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.http import Http404, HttpResponse, HttpResponseRedirect
|
||||
from django.http import Http404, HttpResponse, HttpResponseRedirect, HttpResponseNotModified
|
||||
from django.template import Template, Context, TemplateDoesNotExist
|
||||
import mimetypes
|
||||
import os
|
||||
import posixpath
|
||||
import re
|
||||
import rfc822
|
||||
import stat
|
||||
import urllib
|
||||
|
||||
def serve(request, path, document_root=None, show_indexes=False):
|
||||
"""
|
||||
@ -41,13 +44,19 @@ def serve(request, path, document_root=None, show_indexes=False):
|
||||
if os.path.isdir(fullpath):
|
||||
if show_indexes:
|
||||
return directory_index(newpath, fullpath)
|
||||
else:
|
||||
raise Http404, "Directory indexes are not allowed here."
|
||||
elif not os.path.exists(fullpath):
|
||||
raise Http404, "Directory indexes are not allowed here."
|
||||
if not os.path.exists(fullpath):
|
||||
raise Http404, '"%s" does not exist' % fullpath
|
||||
else:
|
||||
mimetype = mimetypes.guess_type(fullpath)[0]
|
||||
return HttpResponse(open(fullpath, 'rb').read(), mimetype=mimetype)
|
||||
# Respect the If-Modified-Since header.
|
||||
statobj = os.stat(fullpath)
|
||||
if not was_modified_since(request.META.get('HTTP_IF_MODIFIED_SINCE'),
|
||||
statobj[stat.ST_MTIME], statobj[stat.ST_SIZE]):
|
||||
return HttpResponseNotModified()
|
||||
mimetype = mimetypes.guess_type(fullpath)[0]
|
||||
contents = open(fullpath, 'rb').read()
|
||||
response = HttpResponse(contents, mimetype=mimetype)
|
||||
response["Last-Modified"] = rfc822.formatdate(statobj[stat.ST_MTIME])
|
||||
return response
|
||||
|
||||
DEFAULT_DIRECTORY_INDEX_TEMPLATE = """
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
@ -85,3 +94,33 @@ def directory_index(path, fullpath):
|
||||
'file_list' : files,
|
||||
})
|
||||
return HttpResponse(t.render(c))
|
||||
|
||||
def was_modified_since(header=None, mtime=0, size=0):
|
||||
"""
|
||||
Was something modified since the user last downloaded it?
|
||||
|
||||
header
|
||||
This is the value of the If-Modified-Since header. If this is None,
|
||||
I'll just return True.
|
||||
|
||||
mtime
|
||||
This is the modification time of the item we're talking about.
|
||||
|
||||
size
|
||||
This is the size of the item we're talking about.
|
||||
"""
|
||||
try:
|
||||
if header is None:
|
||||
raise ValueError
|
||||
matches = re.match(r"^([^;]+)(; length=([0-9]+))?$", header,
|
||||
re.IGNORECASE)
|
||||
header_mtime = rfc822.mktime_tz(rfc822.parsedate_tz(
|
||||
matches.group(1)))
|
||||
header_len = matches.group(3)
|
||||
if header_len and int(header_len) != size:
|
||||
raise ValueError
|
||||
if mtime > header_mtime:
|
||||
raise ValueError
|
||||
except (AttributeError, ValueError):
|
||||
return True
|
||||
return False
|
||||
|
@ -181,7 +181,7 @@ Short answer: When we're comfortable with Django's APIs, have added all
|
||||
features that we feel are necessary to earn a "1.0" status, and are ready to
|
||||
begin maintaining backwards compatibility. This should happen in a couple of
|
||||
months or so, although it's entirely possible that it could happen earlier.
|
||||
That translates into February or March 2006.
|
||||
That translates into summer 2006.
|
||||
|
||||
Of course, you should note that `quite a few production sites`_ use Django in
|
||||
its current status. Don't let the lack of a 1.0 turn you off.
|
||||
|
@ -21,7 +21,7 @@ Here are some examples of flatpages on Django-powered sites:
|
||||
Installation
|
||||
============
|
||||
|
||||
To install the flatpages app, follow these two steps:
|
||||
To install the flatpages app, follow these steps:
|
||||
|
||||
1. Add ``"django.contrib.flatpages"`` to your INSTALLED_APPS_ setting.
|
||||
2. Add ``"django.contrib.flatpages.middleware.FlatpageFallbackMiddleware"``
|
||||
|
@ -75,7 +75,7 @@ settings file to use. Do that with ``SetEnv``::
|
||||
|
||||
Read the `Django mod_python documentation`_ for more information.
|
||||
|
||||
.. _Django mod_python documentation: http://www.djangoproject.com/documentation/mod_python/
|
||||
.. _Django mod_python documentation: http://www.djangoproject.com/documentation/modpython/
|
||||
|
||||
Default settings
|
||||
================
|
||||
|
@ -1071,7 +1071,7 @@ wordwrap
|
||||
|
||||
Wraps words at specified line length.
|
||||
|
||||
**Argument:** number of words at which to wrap the text
|
||||
**Argument:** number of characters at which to wrap the text
|
||||
|
||||
yesno
|
||||
~~~~~
|
||||
|
Loading…
x
Reference in New Issue
Block a user