1
0
mirror of https://github.com/django/django.git synced 2025-07-04 17:59:13 +00:00

magic-removal: Merged to [2531]

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2532 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-03-19 23:45:00 +00:00
parent 9f248bf394
commit 52a96c1686
2 changed files with 3 additions and 3 deletions

View File

@ -58,7 +58,7 @@ class RelatedObject(object):
change = count - len(objects)
if change > 0:
return objects + [None for _ in range(change)]
return objects + [None] * len(change)
if change < 0:
return objects[:change]
else: # Just right
@ -68,7 +68,7 @@ class RelatedObject(object):
# object
return [attr]
else:
return [None for _ in range(self.field.rel.num_in_admin)]
return [None] * len(self.field.rel.num_in_admin)
def editable_fields(self):
"Get the fields in this class that should be edited inline."

View File

@ -73,12 +73,12 @@ def patch_response_headers(response, cache_timeout=None):
if cache_timeout is None:
cache_timeout = settings.CACHE_MIDDLEWARE_SECONDS
now = datetime.datetime.utcnow()
expires = now + datetime.timedelta(0, cache_timeout)
if not response.has_header('ETag'):
response['ETag'] = md5.new(response.get_content_as_string('utf8')).hexdigest()
if not response.has_header('Last-Modified'):
response['Last-Modified'] = now.strftime('%a, %d %b %Y %H:%M:%S GMT')
if not response.has_header('Expires'):
expires = now + datetime.timedelta(0, cache_timeout)
response['Expires'] = expires.strftime('%a, %d %b %Y %H:%M:%S GMT')
patch_cache_control(response, max_age=cache_timeout)