mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Small optimization on r12285
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12292 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		| @@ -92,8 +92,9 @@ class CookieStorage(BaseStorage): | |||||||
|         if self.max_cookie_size: |         if self.max_cookie_size: | ||||||
|             # data is going to be stored eventually by CompatCookie, which |             # data is going to be stored eventually by CompatCookie, which | ||||||
|             # adds it's own overhead, which we must account for. |             # adds it's own overhead, which we must account for. | ||||||
|  |             cookie = CompatCookie() # create outside the loop | ||||||
|             def stored_length(val): |             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: |             while encoded_data and stored_length(encoded_data) > self.max_cookie_size: | ||||||
|                 if remove_oldest: |                 if remove_oldest: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user