Changeset 175
- Timestamp:
- 07/18/05 12:23:04 (3 years ago)
- Files:
-
- django/trunk/django/utils/text.py (modified) (1 diff)
- django/trunk/django/views/decorators/cache.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/utils/text.py
r3 r175 107 107 'y': '9', 'x': '9'}.get(m.group(0).lower()) 108 108 return letters.sub(char2number, phone) 109 110 # From http://www.xhaus.com/alan/python/httpcomp.html#gzip 111 # Used with permission. 112 def compress_string(s): 113 import cStringIO, gzip 114 zbuf = cStringIO.StringIO() 115 zfile = gzip.GzipFile(mode='wb', compresslevel=6, fileobj=zbuf) 116 zfile.write(s) 117 zfile.close() 118 return zbuf.getvalue() django/trunk/django/views/decorators/cache.py
r3 r175 1 1 from django.core.cache import cache 2 2 from django.utils.httpwrappers import HttpResponseNotModified 3 import cStringIO, datetime, gzip, md5 4 5 # From http://www.xhaus.com/alan/python/httpcomp.html#gzip 6 # Used with permission. 7 def compress_string(s): 8 zbuf = cStringIO.StringIO() 9 zfile = gzip.GzipFile(mode='wb', compresslevel=6, fileobj=zbuf) 10 zfile.write(s) 11 zfile.close() 12 return zbuf.getvalue() 3 from django.utils.text import compress_string 4 import datetime, md5 13 5 14 6 def cache_page(view_func, cache_timeout, key_prefix=''): … … 22 14 use cache; otherwise the cache for one site would affect the other. A good 23 15 example of key_prefix is to use sites.get_current().domain, because that's 24 unique across all CMSinstances on a particular server.16 unique across all Django instances on a particular server. 25 17 """ 26 18 def _check_cache(request, *args, **kwargs):
