Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dh/cloudflare purge errors #492

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions castle/cms/caching/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,12 @@ def purge(self):
success = True
if cf.enabled:
self.cf_enabled = True
resp = CastlePurger.purgeSync(urls, cf)
success = resp.json()['success']
self.resp = CastlePurger.purgeSync(urls, cf)
success = self.resp.json()['success']
if not success:
logger.warning('There was an error with the purge request. '
'Status code: %s, Reason: %s' % (
self.resp.status_code, self.resp.reason))
notify(CacheInvalidatedEvent(self))

nice_paths = []
Expand Down
5 changes: 3 additions & 2 deletions castle/cms/caching/purge.pt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
Portal status message
</div>

<tal:purged tal:condition="view/purged">
<tal:purged tal:condition="view/purged"
tal:define="response view/resp;">
<h3>Purged urls</h3>
<p tal:condition="not: view/success" class="discreet">
There was an error submitted the purge request
There was an error with the purge request. Status code: ${response/status_code}, Reason: ${response/reason}
</p>
<ul class='purge-paths'>
<tal:path tal:repeat="url python: sorted(view.purged)">
Expand Down