Skip to content

Commit

Permalink
Add adapter to list urls to be purged
Browse files Browse the repository at this point in the history
  • Loading branch information
ericof authored and hvelarde committed Sep 13, 2014
1 parent a16a23f commit 52fb7f8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/collective/liveblog/caching/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@
ruleset="collective.liveblog.recent_updades"
/>

<!-- Purge paths for LiveBlog -->
<adapter factory=".purge.LiveBlogPurgePaths" name="liveblog" />

</configure>
22 changes: 22 additions & 0 deletions src/collective/liveblog/caching/purge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
from collective.liveblog.interfaces import ILiveblog
from plone.app.caching.purge import ContentPurgePaths
from z3c.caching.interfaces import IPurgePaths
from zope.component import adapts
from zope.interface import implements


class LiveBlogPurgePaths(ContentPurgePaths):
"""Paths to purge for LiveBlog
"""

implements(IPurgePaths)
adapts(ILiveblog)

def getRelativePaths(self):
paths = super(LiveBlogPurgePaths, self).getRelativePaths()
context = self.context
url = context.absolute_url()
# Also adds recent-updates view to the list of urls to be purged
paths.append('{0}/recent-updates'.format(url))
return paths

0 comments on commit 52fb7f8

Please sign in to comment.