Django

Code

Changeset 2524

Show
Ignore:
Timestamp:
03/15/06 21:02:51 (3 years ago)
Author:
adrian
Message:

magic-removal: Merged to [2523]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/magic-removal/AUTHORS

    r2467 r2524  
    3838    Jiri Barton 
    3939    Ned Batchelder <http://www.nedbatchelder.com/> 
     40    Shannon -jj Behrens <http://jjinux.blogspot.com/> 
    4041    James Bennett 
    4142    Paul Bissex <http://e-scribe.com/> 
  • django/branches/magic-removal/django/conf/locale/zh_TW/LC_MESSAGES/django.po

    r2273 r2524  
    325325#: contrib/comments/templates/comments/form.html:23 
    326326msgid "Required" 
    327 msgstr "
     327msgstr "必需的
    328328 
    329329#: contrib/comments/templates/comments/form.html:12 
    330330#: contrib/comments/templates/comments/form.html:23 
    331331msgid "Optional" 
    332 msgstr "
     332msgstr "可選擇的
    333333 
    334334#: contrib/comments/templates/comments/form.html:23 
    335335msgid "Post a photo" 
    336 msgstr "
     336msgstr "張貼照片
    337337 
    338338#: contrib/comments/templates/comments/form.html:27 
     
    487487#: contrib/admin/views/main.py:415 contrib/admin/views/main.py:492 
    488488msgid "You may edit it again below." 
    489 msgstr "你可以在下面再次編輯。" 
     489msgstr "你可以在下面再編輯一次。" 
    490490 
    491491#: contrib/admin/views/main.py:423 contrib/admin/views/main.py:501 
     
    706706"This object doesn't have a change history. It probably wasn't added via this " 
    707707"admin site." 
    708 msgstr "這個物件沒有變更的歷。它可能不是透過這個管理網站新增的。" 
     708msgstr "這個物件沒有變更的歷。它可能不是透過這個管理網站新增的。" 
    709709 
    710710#: contrib/admin/templates/admin/base_site.html:4 
     
    743743#: contrib/admin/templates/admin/404.html:10 
    744744msgid "We're sorry, but the requested page could not be found." 
    745 msgstr "我們很抱歉,不過被要求的頁面找不到
     745msgstr "我們很抱歉,不過被要求的頁面找不到
    746746 
    747747#: contrib/admin/templates/admin/index.html:27 
     
    756756#: contrib/admin/templates/admin/index.html:43 
    757757msgid "You don't have permission to edit anything." 
    758 msgstr "你沒有編輯任何東西的權限
     758msgstr "你沒有編輯任何東西的權限
    759759 
    760760#: contrib/admin/templates/admin/index.html:51 
     
    777777#: contrib/admin/templates/admin/login.html:20 
    778778msgid "Have you <a href=\"/password_reset/\">forgotten your password</a>?" 
    779 msgstr "你 <a href=\"/password_reset/\">忘記你的密碼了嗎</a>?" 
     779msgstr "你 <a href=\"/password_reset/\">忘記密碼了嗎</a>?" 
    780780 
    781781#: contrib/admin/templates/admin/base.html:23 
     
    10841084#: contrib/flatpages/models/flatpages.py:10 
    10851085msgid "enable comments" 
    1086 msgstr "允許評論" 
     1086msgstr "啟用評論" 
    10871087 
    10881088#: contrib/flatpages/models/flatpages.py:11 
     
    11281128#: utils/dates.py:6 
    11291129msgid "Monday" 
    1130 msgstr "星期一" 
     1130msgstr "一" 
    11311131 
    11321132#: utils/dates.py:6 
    11331133msgid "Tuesday" 
    1134 msgstr "星期二" 
     1134msgstr "二" 
    11351135 
    11361136#: utils/dates.py:6 
    11371137msgid "Wednesday" 
    1138 msgstr "星期三" 
     1138msgstr "三" 
    11391139 
    11401140#: utils/dates.py:6 
    11411141msgid "Thursday" 
    1142 msgstr "星期四" 
     1142msgstr "四" 
    11431143 
    11441144#: utils/dates.py:6 
    11451145msgid "Friday" 
    1146 msgstr "星期五" 
     1146msgstr "五" 
    11471147 
    11481148#: utils/dates.py:7 
    11491149msgid "Saturday" 
    1150 msgstr "星期六" 
     1150msgstr "六" 
    11511151 
    11521152#: utils/dates.py:7 
    11531153msgid "Sunday" 
    1154 msgstr "星期日" 
     1154msgstr "日" 
    11551155 
    11561156#: utils/dates.py:14 
     
    13061306#: models/core.py:67 
    13071307msgid "session key" 
    1308 msgstr "session 鍵
     1308msgstr "session 鍵
    13091309 
    13101310#: models/core.py:68 
     
    14601460#: conf/global_settings.py:48 
    14611461msgid "Japanese" 
    1462 msgstr "
     1462msgstr "日文
    14631463 
    14641464#: conf/global_settings.py:49 
    14651465msgid "Dutch" 
    1466 msgstr "
     1466msgstr "荷蘭文
    14671467 
    14681468#: conf/global_settings.py:50 
     
    16611661msgid "Watch your mouth! The word %s is not allowed here." 
    16621662msgid_plural "Watch your mouth! The words %s are not allowed here." 
    1663 msgstr[0] "看住你的嘴!%s 不允許出現在這裡。" 
     1663msgstr[0] "看管口舌!此處不允許 %s 這樣的字眼。" 
    16641664 
    16651665#: core/validators.py:238 
  • django/branches/magic-removal/django/views/static.py

    r2324 r2524  
    1 import os 
    2 import urllib 
    3 import posixpath 
    4 import mimetypes 
    51from django.template import loader 
    62from django.core.exceptions import ImproperlyConfigured 
    7 from django.http import Http404, HttpResponse, HttpResponseRedirect 
     3from django.http import Http404, HttpResponse, HttpResponseRedirect, HttpResponseNotModified 
    84from django.template import Template, Context, TemplateDoesNotExist 
     5import mimetypes 
     6import os 
     7import posixpath 
     8import re 
     9import rfc822 
     10import stat 
     11import urllib 
    912 
    1013def serve(request, path, document_root=None, show_indexes=False): 
     
    4245        if show_indexes: 
    4346            return directory_index(newpath, fullpath) 
    44         else: 
    45             raise Http404, "Directory indexes are not allowed here." 
    46     elif not os.path.exists(fullpath): 
     47        raise Http404, "Directory indexes are not allowed here." 
     48    if not os.path.exists(fullpath): 
    4749        raise Http404, '"%s" does not exist' % fullpath 
    48     else: 
    49         mimetype = mimetypes.guess_type(fullpath)[0] 
    50         return HttpResponse(open(fullpath, 'rb').read(), mimetype=mimetype) 
     50    # Respect the If-Modified-Since header. 
     51    statobj = os.stat(fullpath) 
     52    if not was_modified_since(request.META.get('HTTP_IF_MODIFIED_SINCE'), 
     53                              statobj[stat.ST_MTIME], statobj[stat.ST_SIZE]): 
     54        return HttpResponseNotModified() 
     55    mimetype = mimetypes.guess_type(fullpath)[0] 
     56    contents = open(fullpath, 'rb').read() 
     57    response = HttpResponse(contents, mimetype=mimetype) 
     58    response["Last-Modified"] = rfc822.formatdate(statobj[stat.ST_MTIME]) 
     59    return response 
    5160 
    5261DEFAULT_DIRECTORY_INDEX_TEMPLATE = """ 
     
    8695    }) 
    8796    return HttpResponse(t.render(c)) 
     97 
     98def was_modified_since(header=None, mtime=0, size=0): 
     99    """ 
     100    Was something modified since the user last downloaded it? 
     101 
     102    header 
     103      This is the value of the If-Modified-Since header.  If this is None, 
     104      I'll just return True. 
     105 
     106    mtime 
     107      This is the modification time of the item we're talking about. 
     108 
     109    size 
     110      This is the size of the item we're talking about. 
     111    """ 
     112    try: 
     113        if header is None: 
     114            raise ValueError 
     115        matches = re.match(r"^([^;]+)(; length=([0-9]+))?$", header, 
     116                           re.IGNORECASE) 
     117        header_mtime = rfc822.mktime_tz(rfc822.parsedate_tz( 
     118            matches.group(1))) 
     119        header_len = matches.group(3) 
     120        if header_len and int(header_len) != size: 
     121            raise ValueError 
     122        if mtime > header_mtime: 
     123            raise ValueError 
     124    except (AttributeError, ValueError): 
     125        return True 
     126    return False 
  • django/branches/magic-removal/docs/faq.txt

    r2369 r2524  
    182182begin maintaining backwards compatibility. This should happen in a couple of 
    183183months or so, although it's entirely possible that it could happen earlier. 
    184 That translates into February or March 2006. 
     184That translates into summer 2006. 
    185185 
    186186Of course, you should note that `quite a few production sites`_ use Django in 
  • django/branches/magic-removal/docs/flatpages.txt

    r1951 r2524  
    2222============ 
    2323 
    24 To install the flatpages app, follow these two steps: 
     24To install the flatpages app, follow these steps: 
    2525 
    2626    1. Add ``"django.contrib.flatpages"`` to your INSTALLED_APPS_ setting. 
  • django/branches/magic-removal/docs/settings.txt

    r2295 r2524  
    7676Read the `Django mod_python documentation`_ for more information. 
    7777 
    78 .. _Django mod_python documentation: http://www.djangoproject.com/documentation/mod_python/ 
     78.. _Django mod_python documentation: http://www.djangoproject.com/documentation/modpython/ 
    7979 
    8080Default settings 
  • django/branches/magic-removal/docs/templates.txt

    r2320 r2524  
    10721072Wraps words at specified line length. 
    10731073 
    1074 **Argument:** number of words at which to wrap the text 
     1074**Argument:** number of characters at which to wrap the text 
    10751075 
    10761076yesno