本文整理汇总了Python中hera.contrib.django_forms.FlushForm.is_valid方法的典型用法代码示例。如果您正苦于以下问题:Python FlushForm.is_valid方法的具体用法?Python FlushForm.is_valid怎么用?Python FlushForm.is_valid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hera.contrib.django_forms.FlushForm
的用法示例。
在下文中一共展示了FlushForm.is_valid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: hera
# 需要导入模块: from hera.contrib.django_forms import FlushForm [as 别名]
# 或者: from hera.contrib.django_forms.FlushForm import is_valid [as 别名]
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
# 需要导入模块: from hera.contrib.django_forms import FlushForm [as 别名]
# 或者: from hera.contrib.django_forms.FlushForm import is_valid [as 别名]
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
# 需要导入模块: from hera.contrib.django_forms import FlushForm [as 别名]
# 或者: from hera.contrib.django_forms.FlushForm import is_valid [as 别名]
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})