本文整理匯總了Python中hera.contrib.django_forms.FlushForm類的典型用法代碼示例。如果您正苦於以下問題:Python FlushForm類的具體用法?Python FlushForm怎麽用?Python FlushForm使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了FlushForm類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: hera
def hera(request):
form = FlushForm(initial={"flushprefix": site_settings.SITE_URL})
boxes = []
configured = False # Default to not showing the form.
for i in site_settings.HERA:
hera = get_hera(i)
r = {"location": urlparse(i["LOCATION"])[1], "stats": False}
if hera:
r["stats"] = hera.getGlobalCacheInfo()
configured = True
boxes.append(r)
if not configured:
messages.error(request, "Hera is not (or mis-)configured.")
form = None
if request.method == "POST" and hera:
form = FlushForm(request.POST)
if form.is_valid():
expressions = request.POST["flushlist"].splitlines()
for url in expressions:
num = flush_urls([url], request.POST["flushprefix"], True)
msg = "Flushed %d objects from front end cache for: %s" % (len(num), url)
log.info("[Hera] (user:%s) %s" % (request.user, msg))
messages.success(request, msg)
return jingo.render(request, "zadmin/hera.html", {"form": form, "boxes": boxes})
示例2: hera
def hera(request):
form = FlushForm(initial={'flushprefix': settings.SITE_URL})
boxes = []
configured = False # Default to not showing the form.
for i in settings.HERA:
hera = get_hera(i)
r = {'location': urlparse(i['LOCATION'])[1], 'stats': False}
if hera:
r['stats'] = hera.getGlobalCacheInfo()
configured = True
boxes.append(r)
if not configured:
messages.error(request, "Hera is not (or mis-)configured.")
form = None
if request.method == 'POST' and hera:
form = FlushForm(request.POST)
if form.is_valid():
expressions = request.POST['flushlist'].splitlines()
for url in expressions:
num = flush_urls([url], request.POST['flushprefix'], True)
msg = ("Flushed %d objects from front end cache for: %s"
% (len(num), url))
log.info("[Hera] (user:%s) %s" % (request.user, msg))
messages.success(request, msg)
return jingo.render(request, 'zadmin/hera.html',
{'form': form, 'boxes': boxes})
示例3: hera
def hera(request):
form = FlushForm(initial={'flushprefix': site_settings.SITE_URL})
hera = get_hera()
if not hera:
messages.error(request, "Hera is not (or mis-)configured.")
form = None
stats = None
else:
stats = hera.getGlobalCacheInfo()
if request.method == 'POST' and hera:
form = FlushForm(request.POST)
if form.is_valid():
expressions = request.POST['flushlist'].splitlines()
for url in expressions:
num = flush_urls([url], request.POST['flushprefix'], True)
msg = ("Flushed %d objects from front end cache for: %s"
% (len(num), url))
log.info("[Hera] (user:%s) %s" % (request.user, msg))
messages.success(request, msg)
return jingo.render(request, 'zadmin/hera.html',
{'form': form, 'stats': stats})