diff --git a/AUTHORS b/AUTHORS index b0097f8852..95cee72037 100644 --- a/AUTHORS +++ b/AUTHORS @@ -37,6 +37,7 @@ answer newbie questions, and generally made Django that much better: Arthur Jiri Barton Ned Batchelder + Shannon -jj Behrens James Bennett Paul Bissex Simon Blanchard diff --git a/django/conf/locale/zh_TW/LC_MESSAGES/django.mo b/django/conf/locale/zh_TW/LC_MESSAGES/django.mo index 5e2e3c0e23..16dba9ddbb 100644 Binary files a/django/conf/locale/zh_TW/LC_MESSAGES/django.mo and b/django/conf/locale/zh_TW/LC_MESSAGES/django.mo differ diff --git a/django/conf/locale/zh_TW/LC_MESSAGES/django.po b/django/conf/locale/zh_TW/LC_MESSAGES/django.po index e6485e24f6..d9331a8ba9 100644 --- a/django/conf/locale/zh_TW/LC_MESSAGES/django.po +++ b/django/conf/locale/zh_TW/LC_MESSAGES/django.po @@ -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 forgotten your password?" -msgstr "你 忘記你的密碼了嗎?" +msgstr "你 忘記密碼了嗎?" #: 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 diff --git a/django/views/static.py b/django/views/static.py index ed6ca5f54d..072a01671e 100644 --- a/django/views/static.py +++ b/django/views/static.py @@ -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 = """ @@ -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 diff --git a/docs/faq.txt b/docs/faq.txt index 240cd166fd..977a3644fe 100644 --- a/docs/faq.txt +++ b/docs/faq.txt @@ -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. diff --git a/docs/flatpages.txt b/docs/flatpages.txt index 863cefeff9..688c4210cf 100644 --- a/docs/flatpages.txt +++ b/docs/flatpages.txt @@ -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"`` diff --git a/docs/settings.txt b/docs/settings.txt index 5c2d980a00..56304ba3b4 100644 --- a/docs/settings.txt +++ b/docs/settings.txt @@ -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 ================ diff --git a/docs/templates.txt b/docs/templates.txt index 66e1943f23..636132a5aa 100644 --- a/docs/templates.txt +++ b/docs/templates.txt @@ -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 ~~~~~