本文整理汇总了Python中models.Service.points方法的典型用法代码示例。如果您正苦于以下问题:Python Service.points方法的具体用法?Python Service.points怎么用?Python Service.points使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Service
的用法示例。
在下文中一共展示了Service.points方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: servicemodule_test
# 需要导入模块: from models import Service [as 别名]
# 或者: from models.Service import points [as 别名]
def servicemodule_test(request, servmdulid = None):
c = getAuthValues(request, {})
if c["auth_name"] != "auth_team_white":
return HttpResponseRedirect("/")
c.update(csrf(request))
c['servmdul_obj'] = ServiceModule.objects.get(servmdulid = servmdulid)
serv_obj = Service(servicemodule = c['servmdul_obj'])
if request.method != "POST":
# Serve blank form with no results
c["service_configs"] = buildServiceConfigForm(serv_obj, TestServiceForm())
return render_to_response('AdminConfig/servicemodule_test.html', c)
c["service_configs"] = buildServiceConfigForm(serv_obj, TestServiceForm(), request.POST)
form_dict = request.POST.copy().dict()
form_dict.pop('csrfmiddlewaretoken')
# Clean network address
if form_dict['networkaddr'][-1] == ".":
form_dict['networkaddr'] = form_dict['networkaddr'][:-1]
if form_dict['networkaddr'][0] == ".":
form_dict['networkaddr'] = form_dict['networkaddr'][1:]
# Clean machine address value
if form_dict['networkloc'][0] == ".":
form_dict['networkloc'] = form_dict['networkloc'][1:]
if form_dict['networkloc'][-1] == ".":
form_dict['networkloc'] = form_dict['networkloc'][:-1]
# Prepare the service object for use in the module
if form_dict.pop('connectip') == u'0':
serv_obj.connectip = False
else:
serv_obj.connectip = True
serv_obj.name = c['servmdul_obj'].modulename
serv_obj.networkloc = str(form_dict.pop('networkloc'))
serv_obj.defaultport = int(form_dict.pop('defaultport'))
serv_obj.points = 100
c['score_obj'] = run_plugin_test(serv_obj, form_dict)
return render_to_response('AdminConfig/servicemodule_test.html', c)