mirror of
https://github.com/django/django.git
synced 2025-07-04 01:39:20 +00:00
boulder-oracle-sprint: Merged to [5193]
git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@5194 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
12702bc683
commit
bcc26d8eea
Binary file not shown.
@ -1344,7 +1344,7 @@ msgstr "四月"
|
||||
|
||||
#: utils/dates.py:19
|
||||
msgid "may"
|
||||
msgstr "三月"
|
||||
msgstr "五月"
|
||||
|
||||
#: utils/dates.py:19
|
||||
msgid "jun"
|
||||
|
Binary file not shown.
@ -46,7 +46,7 @@ msgstr "清除全部"
|
||||
#: contrib/admin/media/js/dateparse.js:32
|
||||
#: contrib/admin/media/js/calendar.js:24
|
||||
msgid "January February March April May June July August September October November December"
|
||||
msgstr "一月 二月 三月 四月 五月 六月 六月 七月 八月 九月 十月 十一月 十二月"
|
||||
msgstr "一月 二月 三月 四月 五月 六月 七月 八月 九月 十月 十一月 十二月"
|
||||
|
||||
#: contrib/admin/media/js/dateparse.js:33
|
||||
msgid "Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
|
||||
|
@ -1,66 +1,69 @@
|
||||
"""
|
||||
Utility functions for generating "lorem ipsum" Latin text.
|
||||
"""
|
||||
|
||||
import random
|
||||
|
||||
COMMON_P = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
|
||||
WORDS = ('exercitationem', 'perferendis', 'perspiciatis', 'laborum', 'eveniet', 'sunt', 'iure', 'nam', 'nobis', 'eum', 'cum', 'officiis', 'excepturi', 'odio', 'consectetur', 'quasi', 'aut', 'quisquam', 'vel', 'eligendi', 'itaque', 'non', 'odit', 'tempore', 'quaerat', 'dignissimos', 'facilis', 'neque', 'nihil', 'expedita', 'vitae', 'vero', 'ipsum', 'nisi', 'animi', 'cumque', 'pariatur', 'velit', 'modi', 'natus', 'iusto', 'eaque', 'sequi', 'illo', 'sed', 'ex', 'et', 'voluptatibus', 'tempora', 'veritatis', 'ratione', 'assumenda', 'incidunt', 'nostrum', 'placeat', 'aliquid', 'fuga', 'provident', 'praesentium', 'rem', 'necessitatibus', 'suscipit', 'adipisci', 'quidem', 'possimus', 'voluptas', 'debitis', 'sint', 'accusantium', 'unde', 'sapiente', 'voluptate', 'qui', 'aspernatur', 'laudantium', 'soluta', 'amet', 'quo', 'aliquam', 'saepe', 'culpa', 'libero', 'ipsa', 'dicta', 'reiciendis', 'nesciunt', 'doloribus', 'autem', 'impedit', 'minima', 'maiores', 'repudiandae', 'ipsam', 'obcaecati', 'ullam', 'enim', 'totam', 'delectus', 'ducimus', 'quis', 'voluptates', 'dolores', 'molestiae', 'harum', 'dolorem', 'quia', 'voluptatem', 'molestias', 'magni', 'distinctio', 'omnis', 'illum', 'dolorum', 'voluptatum', 'ea', 'quas', 'quam', 'corporis', 'quae', 'blanditiis', 'atque', 'deserunt', 'laboriosam', 'earum', 'consequuntur', 'hic', 'cupiditate', 'quibusdam', 'accusamus', 'ut', 'rerum', 'error', 'minus', 'eius', 'ab', 'ad', 'nemo', 'fugit', 'officia', 'at', 'in', 'id', 'quos', 'reprehenderit', 'numquam', 'iste', 'fugiat', 'sit', 'inventore', 'beatae', 'repellendus', 'magnam', 'recusandae', 'quod', 'explicabo', 'doloremque', 'aperiam', 'consequatur', 'asperiores', 'commodi', 'optio', 'dolor', 'labore', 'temporibus', 'repellat', 'veniam', 'architecto', 'est', 'esse', 'mollitia', 'nulla', 'a', 'similique', 'eos', 'alias', 'dolore', 'tenetur', 'deleniti', 'porro', 'facere', 'maxime', 'corrupti')
|
||||
COMMON_WORDS = ('lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipisicing', 'elit', 'sed', 'do', 'eiusmod', 'tempor', 'incididunt', 'ut', 'labore', 'et', 'dolore', 'magna', 'aliqua')
|
||||
|
||||
def sentence():
|
||||
"""
|
||||
Returns a randomly generated sentence of lorem ipsum text.
|
||||
|
||||
The first word is capitalized, and the sentence ends in either a period or
|
||||
question mark. Commas are added at random.
|
||||
"""
|
||||
# Determine the number of comma-separated sections and number of words in
|
||||
# each section for this sentence.
|
||||
sections = [' '.join(random.sample(WORDS, random.randint(3, 12))) for i in range(random.randint(1, 5))]
|
||||
s = ', '.join(sections)
|
||||
# Convert to sentence case and add end punctuation.
|
||||
return '%s%s%s' % (s[0].upper(), s[1:], random.choice('?.'))
|
||||
|
||||
def paragraph():
|
||||
"""
|
||||
Returns a randomly generated paragraph of lorem ipsum text.
|
||||
|
||||
The paragraph consists of between 1 and 4 sentences, inclusive.
|
||||
"""
|
||||
return ' '.join([sentence() for i in range(random.randint(1, 4))])
|
||||
|
||||
def paragraphs(count, common=True):
|
||||
"""
|
||||
Returns a list of paragraphs as returned by paragraph().
|
||||
|
||||
If `common` is True, then the first paragraph will be the standard
|
||||
'lorem ipsum' paragraph. Otherwise, the first paragraph will be random
|
||||
Latin text. Either way, subsequent paragraphs will be random Latin text.
|
||||
"""
|
||||
paras = []
|
||||
for i in range(count):
|
||||
if common and i == 0:
|
||||
paras.append(COMMON_P)
|
||||
else:
|
||||
paras.append(paragraph())
|
||||
return paras
|
||||
|
||||
def words(count, common=True):
|
||||
"""
|
||||
Returns a string of `count` lorem ipsum words separated by a single space.
|
||||
|
||||
If `common` is True, then the first 19 words will be the standard
|
||||
'lorem ipsum' words. Otherwise, all words will be selected randomly.
|
||||
"""
|
||||
if common:
|
||||
word_list = list(COMMON_WORDS)
|
||||
else:
|
||||
word_list = []
|
||||
c = len(word_list)
|
||||
if count > c:
|
||||
count = min(count - c, len(WORDS))
|
||||
word_list += random.sample(WORDS, count - c)
|
||||
else:
|
||||
word_list = word_list[:count]
|
||||
return ' '.join(word_list)
|
||||
"""
|
||||
Utility functions for generating "lorem ipsum" Latin text.
|
||||
"""
|
||||
|
||||
import random
|
||||
|
||||
COMMON_P = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
|
||||
WORDS = ('exercitationem', 'perferendis', 'perspiciatis', 'laborum', 'eveniet', 'sunt', 'iure', 'nam', 'nobis', 'eum', 'cum', 'officiis', 'excepturi', 'odio', 'consectetur', 'quasi', 'aut', 'quisquam', 'vel', 'eligendi', 'itaque', 'non', 'odit', 'tempore', 'quaerat', 'dignissimos', 'facilis', 'neque', 'nihil', 'expedita', 'vitae', 'vero', 'ipsum', 'nisi', 'animi', 'cumque', 'pariatur', 'velit', 'modi', 'natus', 'iusto', 'eaque', 'sequi', 'illo', 'sed', 'ex', 'et', 'voluptatibus', 'tempora', 'veritatis', 'ratione', 'assumenda', 'incidunt', 'nostrum', 'placeat', 'aliquid', 'fuga', 'provident', 'praesentium', 'rem', 'necessitatibus', 'suscipit', 'adipisci', 'quidem', 'possimus', 'voluptas', 'debitis', 'sint', 'accusantium', 'unde', 'sapiente', 'voluptate', 'qui', 'aspernatur', 'laudantium', 'soluta', 'amet', 'quo', 'aliquam', 'saepe', 'culpa', 'libero', 'ipsa', 'dicta', 'reiciendis', 'nesciunt', 'doloribus', 'autem', 'impedit', 'minima', 'maiores', 'repudiandae', 'ipsam', 'obcaecati', 'ullam', 'enim', 'totam', 'delectus', 'ducimus', 'quis', 'voluptates', 'dolores', 'molestiae', 'harum', 'dolorem', 'quia', 'voluptatem', 'molestias', 'magni', 'distinctio', 'omnis', 'illum', 'dolorum', 'voluptatum', 'ea', 'quas', 'quam', 'corporis', 'quae', 'blanditiis', 'atque', 'deserunt', 'laboriosam', 'earum', 'consequuntur', 'hic', 'cupiditate', 'quibusdam', 'accusamus', 'ut', 'rerum', 'error', 'minus', 'eius', 'ab', 'ad', 'nemo', 'fugit', 'officia', 'at', 'in', 'id', 'quos', 'reprehenderit', 'numquam', 'iste', 'fugiat', 'sit', 'inventore', 'beatae', 'repellendus', 'magnam', 'recusandae', 'quod', 'explicabo', 'doloremque', 'aperiam', 'consequatur', 'asperiores', 'commodi', 'optio', 'dolor', 'labore', 'temporibus', 'repellat', 'veniam', 'architecto', 'est', 'esse', 'mollitia', 'nulla', 'a', 'similique', 'eos', 'alias', 'dolore', 'tenetur', 'deleniti', 'porro', 'facere', 'maxime', 'corrupti')
|
||||
COMMON_WORDS = ('lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipisicing', 'elit', 'sed', 'do', 'eiusmod', 'tempor', 'incididunt', 'ut', 'labore', 'et', 'dolore', 'magna', 'aliqua')
|
||||
|
||||
def sentence():
|
||||
"""
|
||||
Returns a randomly generated sentence of lorem ipsum text.
|
||||
|
||||
The first word is capitalized, and the sentence ends in either a period or
|
||||
question mark. Commas are added at random.
|
||||
"""
|
||||
# Determine the number of comma-separated sections and number of words in
|
||||
# each section for this sentence.
|
||||
sections = [' '.join(random.sample(WORDS, random.randint(3, 12))) for i in range(random.randint(1, 5))]
|
||||
s = ', '.join(sections)
|
||||
# Convert to sentence case and add end punctuation.
|
||||
return '%s%s%s' % (s[0].upper(), s[1:], random.choice('?.'))
|
||||
|
||||
def paragraph():
|
||||
"""
|
||||
Returns a randomly generated paragraph of lorem ipsum text.
|
||||
|
||||
The paragraph consists of between 1 and 4 sentences, inclusive.
|
||||
"""
|
||||
return ' '.join([sentence() for i in range(random.randint(1, 4))])
|
||||
|
||||
def paragraphs(count, common=True):
|
||||
"""
|
||||
Returns a list of paragraphs as returned by paragraph().
|
||||
|
||||
If `common` is True, then the first paragraph will be the standard
|
||||
'lorem ipsum' paragraph. Otherwise, the first paragraph will be random
|
||||
Latin text. Either way, subsequent paragraphs will be random Latin text.
|
||||
"""
|
||||
paras = []
|
||||
for i in range(count):
|
||||
if common and i == 0:
|
||||
paras.append(COMMON_P)
|
||||
else:
|
||||
paras.append(paragraph())
|
||||
return paras
|
||||
|
||||
def words(count, common=True):
|
||||
"""
|
||||
Returns a string of `count` lorem ipsum words separated by a single space.
|
||||
|
||||
If `common` is True, then the first 19 words will be the standard
|
||||
'lorem ipsum' words. Otherwise, all words will be selected randomly.
|
||||
"""
|
||||
if common:
|
||||
word_list = list(COMMON_WORDS)
|
||||
else:
|
||||
word_list = []
|
||||
c = len(word_list)
|
||||
if count > c:
|
||||
count -= c
|
||||
while count > 0:
|
||||
c = min(count, len(WORDS))
|
||||
count -= c
|
||||
word_list += random.sample(WORDS, c)
|
||||
else:
|
||||
word_list = word_list[:count]
|
||||
return ' '.join(word_list)
|
||||
|
@ -91,6 +91,10 @@ class QueryDict(MultiValueDict):
|
||||
self._assert_mutable()
|
||||
MultiValueDict.__setitem__(self, key, value)
|
||||
|
||||
def __delitem__(self, key):
|
||||
self._assert_mutable()
|
||||
super(QueryDict, self).__delitem__(key)
|
||||
|
||||
def __copy__(self):
|
||||
result = self.__class__('', mutable=True)
|
||||
for key, value in dict.items(self):
|
||||
|
@ -56,7 +56,7 @@ installed.
|
||||
either ``postgresql`` [for version 1] or ``postgresql_psycopg2`` [for version 2].)
|
||||
|
||||
If you're on Windows, check out the unofficial `compiled Windows version`_.
|
||||
|
||||
|
||||
* If you're using MySQL, you'll need MySQLdb_, version 1.2.1p2 or higher.
|
||||
You will also want to read the database-specific notes for the `MySQL backend`_.
|
||||
|
||||
@ -78,16 +78,16 @@ installed.
|
||||
Remove any old versions of Django
|
||||
=================================
|
||||
|
||||
If you are upgrading your installation of Django from a previous version,
|
||||
you will need to uninstall the old Django version before installing the
|
||||
new version.
|
||||
If you are upgrading your installation of Django from a previous version,
|
||||
you will need to uninstall the old Django version before installing the
|
||||
new version.
|
||||
|
||||
If you installed Django using ``setup.py install``, uninstalling
|
||||
is as simple as deleting the ``django`` directory from your Python
|
||||
is as simple as deleting the ``django`` directory from your Python
|
||||
``site-packages``.
|
||||
|
||||
If you installed Django from a Python Egg, remove the Django ``.egg` file,
|
||||
and remove the reference to the egg in the file named ``easy-install.pth``.
|
||||
If you installed Django from a Python Egg, remove the Django ``.egg`` file,
|
||||
and remove the reference to the egg in the file named ``easy-install.pth``.
|
||||
This file should also be located in your ``site-packages`` directory.
|
||||
|
||||
.. admonition:: Where are my ``site-packages`` stored?
|
||||
@ -95,7 +95,7 @@ This file should also be located in your ``site-packages`` directory.
|
||||
The location of the ``site-packages`` directory depends on the operating
|
||||
system, and the location in which Python was installed. However, the
|
||||
following locations are common:
|
||||
|
||||
|
||||
* If you're using Linux: ``/usr/lib/python2.X/site-packages``
|
||||
|
||||
* If you're using Windows: ``C:\Python2.X\lib\site-packages``
|
||||
|
@ -717,7 +717,7 @@ object::
|
||||
# split_contents() knows not to split quoted strings.
|
||||
tag_name, format_string = token.split_contents()
|
||||
except ValueError:
|
||||
raise template.TemplateSyntaxError, "%r tag requires a single argument" % token.contents[0]
|
||||
raise template.TemplateSyntaxError, "%r tag requires a single argument" % token.contents.split()[0]
|
||||
if not (format_string[0] == format_string[-1] and format_string[0] in ('"', "'")):
|
||||
raise template.TemplateSyntaxError, "%r tag's argument should be in quotes" % tag_name
|
||||
return CurrentTimeNode(format_string[1:-1])
|
||||
@ -846,7 +846,7 @@ Now your tag should begin to look like this::
|
||||
# split_contents() knows not to split quoted strings.
|
||||
tag_name, date_to_be_formatted, format_string = token.split_contents()
|
||||
except ValueError:
|
||||
raise template.TemplateSyntaxError, "%r tag requires exactly two arguments" % token.contents[0]
|
||||
raise template.TemplateSyntaxError, "%r tag requires exactly two arguments" % token.contents.split()[0]
|
||||
if not (format_string[0] == format_string[-1] and format_string[0] in ('"', "'")):
|
||||
raise template.TemplateSyntaxError, "%r tag's argument should be in quotes" % tag_name
|
||||
return FormatTimeNode(date_to_be_formatted, format_string[1:-1])
|
||||
@ -1080,7 +1080,7 @@ class, like so::
|
||||
# Splitting by None == splitting by spaces.
|
||||
tag_name, arg = token.contents.split(None, 1)
|
||||
except ValueError:
|
||||
raise template.TemplateSyntaxError, "%r tag requires arguments" % token.contents[0]
|
||||
raise template.TemplateSyntaxError, "%r tag requires arguments" % token.contents.split()[0]
|
||||
m = re.search(r'(.*?) as (\w+)', arg)
|
||||
if not m:
|
||||
raise template.TemplateSyntaxError, "%r tag had invalid arguments" % tag_name
|
||||
|
@ -96,6 +96,12 @@ MultiValueDictKeyError: "Key 'foo' not found in <MultiValueDict: {}>"
|
||||
>>> q['name']
|
||||
'john'
|
||||
|
||||
>>> del q['name']
|
||||
>>> 'name' in q
|
||||
False
|
||||
|
||||
>>> q['name'] = 'john'
|
||||
|
||||
>>> q.get('foo', 'default')
|
||||
'default'
|
||||
|
||||
@ -367,6 +373,11 @@ AttributeError: This QueryDict instance is immutable
|
||||
>>> q.urlencode()
|
||||
'vote=yes&vote=no'
|
||||
|
||||
>>> del q['vote']
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
AttributeError: This QueryDict instance is immutable
|
||||
|
||||
"""
|
||||
|
||||
from django.http import QueryDict
|
||||
|
Loading…
x
Reference in New Issue
Block a user