Permalink
Browse files

Moves get_cache_key.

  • Loading branch information...
1 parent f158010 commit eb56422b2d10339c49bd8fbc6f8f22427fafee20 @BertrandBordage committed Aug 29, 2012
Showing with 7 additions and 7 deletions.
  1. +2 −5 cmsplugin_footnote/models.py
  2. +5 −2 cmsplugin_footnote/utils.py
@@ -3,6 +3,7 @@
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import truncatewords_html
from django.utils.html import strip_tags
+from .utils import get_cache_key
from django.core.cache import cache
@@ -20,9 +21,5 @@ def __unicode__(self):
def save(self, *args, **kwargs):
super(Footnote, self).save(*args, **kwargs)
placeholder, page = self.placeholder, self.placeholder.page
- cache_key = self.get_cache_key(page, placeholder.slot)
+ cache_key = get_cache_key(page, placeholder.slot)
cache.delete(cache_key)
-
- @staticmethod
- def get_cache_key(page, placeholder_name):
- return 'footnote_plugins_%d_%s' % (page.pk, placeholder_name)
@@ -1,9 +1,12 @@
-from .models import Footnote
from django.core.cache import cache
+def get_cache_key(page, placeholder_name):
+ return 'footnote_plugins_%d_%s' % (page.pk, placeholder_name)
+
+
def get_footnote_plugins(page, placeholder_name):
- cache_key = Footnote.get_cache_key(page, placeholder_name)
+ cache_key = get_cache_key(page, placeholder_name)
footnote_plugins = cache.get(cache_key)
if footnote_plugins is None:
placeholder = page.placeholders.get(slot=placeholder_name)

0 comments on commit eb56422

Please sign in to comment.