~ubuntu-branches/ubuntu/quantal/python-django/quantal

« back to all changes in this revision

Viewing changes to django/templatetags/cache.py

  • Committer: Bazaar Package Importer
  • Author(s): Chris Lamb
  • Date: 2009-07-29 11:26:28 UTC
  • mfrom: (1.1.8 upstream) (4.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20090729112628-pg09ino8sz0sj21t
Tags: 1.1-1
* New upstream release.
* Merge from experimental:
  - Ship FastCGI initscript and /etc/default file in python-django's examples
    directory (Closes: #538863)
  - Drop "05_10539-sphinx06-compatibility.diff"; it has been applied
    upstream.
  - Bump Standards-Version to 3.8.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
from django.core.cache import cache
4
4
from django.utils.encoding import force_unicode
5
5
from django.utils.http import urlquote
 
6
from django.utils.hashcompat import md5_constructor
6
7
 
7
8
register = Library()
8
9
 
23
24
        except (ValueError, TypeError):
24
25
            raise TemplateSyntaxError('"cache" tag got a non-integer timeout value: %r' % expire_time)
25
26
        # Build a unicode key for this fragment and all vary-on's.
26
 
        cache_key = u':'.join([self.fragment_name] + [urlquote(resolve_variable(var, context)) for var in self.vary_on])
 
27
        args = md5_constructor(u':'.join([urlquote(resolve_variable(var, context)) for var in self.vary_on]))
 
28
        cache_key = 'template.cache.%s.%s' % (self.fragment_name, args.hexdigest())
27
29
        value = cache.get(cache_key)
28
30
        if value is None:
29
31
            value = self.nodelist.render(context)