- def short_html(self):
- if self.id:
- cache_key = "Fragment.short_html/%d/%s" % (self.id, get_language())
- short_html = permanent_cache.get(cache_key)
- else:
- short_html = None
-
- if short_html is not None:
- return mark_safe(short_html)
- else:
- short_html = unicode(render_to_string('catalogue/fragment_short.html',
- {'fragment': self}))
- if self.id:
- permanent_cache.set(cache_key, short_html)
- return mark_safe(short_html)
+ def flush_includes(self, languages=True):
+ if not languages:
+ return
+ if languages is True:
+ languages = [lc for (lc, _ln) in settings.LANGUAGES]
+ flush_ssi_includes([
+ template % (self.pk, lang)
+ for template in [
+ '/katalog/f/%d/short.%s.html',
+ '/api/include/fragment/%d.%s.json',
+ '/api/include/fragment/%d.%s.xml',
+ ]
+ for lang in languages
+ ])