本文整理汇总了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})