diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2010-01-25 18:14:30 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2010-01-25 18:14:30 +0000 |
| commit | 65c1dfe67bb03c92adcb0013db6ba8fa3ba12940 (patch) | |
| tree | 3e1eccce16c918fa02e2b3663cfb142362600d99 | |
| parent | 89f81810ed65f68b22d0e0b60ba589c814fb539a (diff) | |
Small optimization on r12285
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12292 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/messages/storage/cookie.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/contrib/messages/storage/cookie.py b/django/contrib/messages/storage/cookie.py index 48811a796d..1fd3ed98d8 100644 --- a/django/contrib/messages/storage/cookie.py +++ b/django/contrib/messages/storage/cookie.py @@ -92,8 +92,9 @@ class CookieStorage(BaseStorage): 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: |
