projects
/
pgweb.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7bf9980
)
Support xkey purge requests on the API endpoint
author
Magnus Hagander
<magnus@hagander.net>
Wed, 19 Jun 2019 19:26:18 +0000
(21:26 +0200)
committer
Magnus Hagander
<magnus@hagander.net>
Wed, 19 Jun 2019 19:26:18 +0000
(21:26 +0200)
Simply specigfying "x<n>" instead o "p<n>" should do the trick.
pgweb/core/views.py
patch
|
blob
|
blame
|
history
diff --git
a/pgweb/core/views.py
b/pgweb/core/views.py
index 6e256f1f88169de33f1755bd8ad51e7fc3d62b3d..c1d34d12131ad91eec1e31af54c1f638486d2299 100644
(file)
--- a/
pgweb/core/views.py
+++ b/
pgweb/core/views.py
@@
-328,8
+328,11
@@
def api_varnish_purge(request):
n = int(request.POST['n'])
curs = connection.cursor()
for i in range(0, n):
- expr = request.POST['p%s' % i]
- curs.execute("SELECT varnish_purge_expr(%s)", (expr, ))
+ if 'p{0}'.format(i) in request.POST:
+ curs.execute("SELECT varnish_purge_expr(%s)", (request.POST['p{0}'.format(i)], ))
+ if 'x{0}'.format(i) in request.POST:
+ curs.execute("SELECT varnish_purge_xkey(%s)", (request.POST['x{0}'.format(i)], ))
+
return HttpResponse("Purged %s entries\n" % n)