Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Small optimization on r12285

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 89f8181 commit 65c1dfe67bb03c92adcb0013db6ba8fa3ba12940 @spookylukey spookylukey committed
Showing with 2 additions and 1 deletion.
  1. +2 −1  django/contrib/messages/storage/
3  django/contrib/messages/storage/
@@ -92,8 +92,9 @@ def _store(self, messages, response, remove_oldest=True, *args, **kwargs):
if self.max_cookie_size:
# data is going to be stored eventually by CompatCookie, which
# adds it's own overhead, which we must account for.
+ cookie = CompatCookie() # create outside the loop
def stored_length(val):
- return len(CompatCookie().value_encode(val)[1])
+ return len(cookie.value_encode(val)[1])
while encoded_data and stored_length(encoded_data) > self.max_cookie_size:
if remove_oldest:

0 comments on commit 65c1dfe

Please sign in to comment.
Something went wrong with that request. Please try again.