mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
magic-removal: Merged to [2687]
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2688 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
af0056201e
commit
873b12b94d
@ -80,7 +80,7 @@ def result_headers(cl):
|
|||||||
if field_name == '__str__':
|
if field_name == '__str__':
|
||||||
header = lookup_opts.verbose_name
|
header = lookup_opts.verbose_name
|
||||||
else:
|
else:
|
||||||
attr = getattr(cl.model, field_name) # Let AttributeErrors propogate.
|
attr = getattr(cl.model, field_name) # Let AttributeErrors propagate.
|
||||||
try:
|
try:
|
||||||
header = attr.short_description
|
header = attr.short_description
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
@ -46,7 +46,7 @@ class FileWrapper:
|
|||||||
raise StopIteration
|
raise StopIteration
|
||||||
|
|
||||||
# Regular expression that matches `special' characters in parameters, the
|
# Regular expression that matches `special' characters in parameters, the
|
||||||
# existance of which force quoting of the parameter value.
|
# existence of which force quoting of the parameter value.
|
||||||
tspecials = re.compile(r'[ \(\)<>@,;:\\"/\[\]\?=]')
|
tspecials = re.compile(r'[ \(\)<>@,;:\\"/\[\]\?=]')
|
||||||
|
|
||||||
def _formatparam(param, value=None, quote=1):
|
def _formatparam(param, value=None, quote=1):
|
||||||
|
@ -260,7 +260,7 @@ class AutomaticChangeManipulator(AutomaticManipulator):
|
|||||||
if self.opts.one_to_one_field:
|
if self.opts.one_to_one_field:
|
||||||
# Sanity check -- Make sure the "parent" object exists.
|
# Sanity check -- Make sure the "parent" object exists.
|
||||||
# For example, make sure the Place exists for the Restaurant.
|
# For example, make sure the Place exists for the Restaurant.
|
||||||
# Let the ObjectDoesNotExist exception propogate up.
|
# Let the ObjectDoesNotExist exception propagate up.
|
||||||
lookup_kwargs = self.opts.one_to_one_field.rel.limit_choices_to
|
lookup_kwargs = self.opts.one_to_one_field.rel.limit_choices_to
|
||||||
lookup_kwargs['%s__exact' % self.opts.one_to_one_field.rel.field_name] = obj_key
|
lookup_kwargs['%s__exact' % self.opts.one_to_one_field.rel.field_name] = obj_key
|
||||||
self.opts.one_to_one_field.rel.to.get_model_module().get(**lookup_kwargs)
|
self.opts.one_to_one_field.rel.to.get_model_module().get(**lookup_kwargs)
|
||||||
|
@ -268,7 +268,7 @@ class QuerySet(object):
|
|||||||
"""
|
"""
|
||||||
assert kind in ("month", "year", "day"), "'kind' must be one of 'year', 'month' or 'day'."
|
assert kind in ("month", "year", "day"), "'kind' must be one of 'year', 'month' or 'day'."
|
||||||
assert order in ('ASC', 'DESC'), "'order' must be either 'ASC' or 'DESC'."
|
assert order in ('ASC', 'DESC'), "'order' must be either 'ASC' or 'DESC'."
|
||||||
# Let the FieldDoesNotExist exception propogate.
|
# Let the FieldDoesNotExist exception propagate.
|
||||||
field = self.model._meta.get_field(field_name, many_to_many=False)
|
field = self.model._meta.get_field(field_name, many_to_many=False)
|
||||||
assert isinstance(field, DateField), "%r isn't a DateField." % field_name
|
assert isinstance(field, DateField), "%r isn't a DateField." % field_name
|
||||||
return self._clone(klass=DateQuerySet, _field=field, _kind=kind, _order=order)
|
return self._clone(klass=DateQuerySet, _field=field, _kind=kind, _order=order)
|
||||||
|
@ -149,7 +149,7 @@ class _localbase(object):
|
|||||||
raise TypeError("Initialization arguments are not supported")
|
raise TypeError("Initialization arguments are not supported")
|
||||||
|
|
||||||
# We need to create the thread dict in anticipation of
|
# We need to create the thread dict in anticipation of
|
||||||
# __init__ being called, to make sire we don't cal it
|
# __init__ being called, to make sure we don't call it
|
||||||
# again ourselves.
|
# again ourselves.
|
||||||
dict = object.__getattribute__(self, '__dict__')
|
dict = object.__getattribute__(self, '__dict__')
|
||||||
currentThread().__dict__[key] = dict
|
currentThread().__dict__[key] = dict
|
||||||
|
@ -190,7 +190,7 @@ Error handling
|
|||||||
==============
|
==============
|
||||||
|
|
||||||
When you use Apache/mod_python, errors will be caught by Django -- in other
|
When you use Apache/mod_python, errors will be caught by Django -- in other
|
||||||
words, they won't propogate to the Apache level and won't appear in the Apache
|
words, they won't propagate to the Apache level and won't appear in the Apache
|
||||||
``error_log``.
|
``error_log``.
|
||||||
|
|
||||||
The exception for this is if something is really wonky in your Django setup. In
|
The exception for this is if something is really wonky in your Django setup. In
|
||||||
|
@ -846,7 +846,7 @@ class DocTestFinder:
|
|||||||
if extraglobs is not None:
|
if extraglobs is not None:
|
||||||
globs.update(extraglobs)
|
globs.update(extraglobs)
|
||||||
|
|
||||||
# Recursively expore `obj`, extracting DocTests.
|
# Recursively explore `obj`, extracting DocTests.
|
||||||
tests = []
|
tests = []
|
||||||
self._find(tests, obj, name, module, source_lines, globs, {})
|
self._find(tests, obj, name, module, source_lines, globs, {})
|
||||||
return tests
|
return tests
|
||||||
@ -1210,7 +1210,7 @@ class DocTestRunner:
|
|||||||
# Process each example.
|
# Process each example.
|
||||||
for examplenum, example in enumerate(test.examples):
|
for examplenum, example in enumerate(test.examples):
|
||||||
|
|
||||||
# If REPORT_ONLY_FIRST_FAILURE is set, then supress
|
# If REPORT_ONLY_FIRST_FAILURE is set, then suppress
|
||||||
# reporting after the first failure.
|
# reporting after the first failure.
|
||||||
quiet = (self.optionflags & REPORT_ONLY_FIRST_FAILURE and
|
quiet = (self.optionflags & REPORT_ONLY_FIRST_FAILURE and
|
||||||
failures > 0)
|
failures > 0)
|
||||||
|
@ -330,7 +330,7 @@ datetime.datetime(2005, 7, 31, 12, 30, 45)
|
|||||||
|
|
||||||
API_TESTS += """
|
API_TESTS += """
|
||||||
|
|
||||||
# You can manually specify the primary key when creating a new objet
|
# You can manually specify the primary key when creating a new object.
|
||||||
>>> a101 = Article(id=101, headline='Article 101', pub_date=datetime(2005, 7, 31, 12, 30, 45))
|
>>> a101 = Article(id=101, headline='Article 101', pub_date=datetime(2005, 7, 31, 12, 30, 45))
|
||||||
>>> a101.save()
|
>>> a101.save()
|
||||||
>>> a101 = Article.objects.get(pk=101)
|
>>> a101 = Article.objects.get(pk=101)
|
||||||
|
@ -15,7 +15,7 @@ class C:
|
|||||||
cache.set("key", "value")
|
cache.set("key", "value")
|
||||||
assert cache.get("key") == "value"
|
assert cache.get("key") == "value"
|
||||||
|
|
||||||
# get with non-existant keys
|
# get with non-existent keys
|
||||||
assert cache.get("does not exist") is None
|
assert cache.get("does not exist") is None
|
||||||
assert cache.get("does not exist", "bang!") == "bang!"
|
assert cache.get("does not exist", "bang!") == "bang!"
|
||||||
|
|
||||||
@ -57,4 +57,4 @@ for (key, value) in stuff.items():
|
|||||||
# expiration
|
# expiration
|
||||||
cache.set('expire', 'very quickly', 1)
|
cache.set('expire', 'very quickly', 1)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
assert cache.get("expire") == None
|
assert cache.get("expire") == None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user