本文整理汇总了Python中transaction.Transaction.set_current_step方法的典型用法代码示例。如果您正苦于以下问题:Python Transaction.set_current_step方法的具体用法?Python Transaction.set_current_step怎么用?Python Transaction.set_current_step使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类transaction.Transaction
的用法示例。
在下文中一共展示了Transaction.set_current_step方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: download
# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import set_current_step [as 别名]
def download(request):
transaction = Transaction(request)
transaction.set_current_step(Steps.DOWNLOAD)
if transaction.current_step()['state'] in (State.DONE, State.DISABLED):
return HttpResponseRedirect(transaction.next_step_url())
return render(request, 'download.html', {'transaction': transaction})
示例2: config
# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import set_current_step [as 别名]
def config(request):
""" configuration page """
transaction = Transaction(request)
transaction.set_current_step(Steps.CONFIG)
if transaction.current_step()['state'] in (State.DONE, State.DISABLED):
return HttpResponseRedirect(transaction.next_step_url())
config = xmlrpc.call('get_config', transaction.modules_list)
run_config = False
skip_config = True
for module in transaction.modules_info:
if module["has_configuration"]:
skip_config = False
if module["has_configuration_script"]:
run_config = True
# modules don't have configuration scripts
if not run_config:
for module in transaction.modules_list:
config_end(request, module)
return render(request, 'config_no.html', {'transaction': transaction})
# some module have configuration
elif not skip_config:
return render(request, 'config.html', {'transaction': transaction, 'config': config})
else:
return HttpResponseRedirect(reverse('config_valid'))
示例3: medias_auth
# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import set_current_step [as 别名]
def medias_auth(request):
""" media auth page """
transaction = Transaction(request)
transaction.set_current_step(Steps.MEDIAS_AUTH)
if transaction.current_step()['state'] in (State.DONE, State.DISABLED):
return HttpResponseRedirect(transaction.next_step_url())
return render(request, 'media_auth.html', {'transaction': transaction})
示例4: preinst
# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import set_current_step [as 别名]
def preinst(request):
""" preinst page """
transaction = Transaction(request)
transaction.set_current_step(Steps.PREINST)
if transaction.current_step()['state'] in (State.DONE, State.DISABLED):
return HttpResponseRedirect(transaction.next_step_url())
return render(request, 'preinst.html', {'transaction': transaction})
示例5: end
# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import set_current_step [as 别名]
def end(request):
transaction = Transaction(request)
transaction.set_current_step(Steps.END)
for module in transaction.modules_list:
xmlrpc.call("end_config", module, 0, "")
return render(request, "end.html", {"transaction": transaction})
示例6: end
# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import set_current_step [as 别名]
def end(request):
transaction = Transaction(request)
transaction.set_current_step(Steps.END)
for module in transaction.modules_list:
xmlrpc.call('end_config', module, 0, "")
return render(request, 'end.html',
{'transaction': transaction})
示例7: install
# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import set_current_step [as 别名]
def install(request):
""" install page """
transaction = Transaction(request)
transaction.set_current_step(Steps.INSTALL)
if transaction.current_step()['state'] in (State.DONE, State.DISABLED):
return HttpResponseRedirect(transaction.next_step_url())
# launch modules install
xmlrpc.call('install_modules', transaction.modules_list)
return render(request, 'install.html', {'transaction': transaction})
示例8: medias_add
# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import set_current_step [as 别名]
def medias_add(request):
""" media add page """
transaction = Transaction(request)
transaction.set_current_step(Steps.MEDIAS_ADD)
if transaction.current_step()['state'] in (State.DONE, State.DISABLED):
return HttpResponseRedirect(transaction.next_step_url())
if request.method == "POST":
username = request.POST.get('username', None)
password = request.POST.get('password', None)
else:
username = None
password = None
repositories = xmlrpc.call('get_repositories', transaction.modules_list)
return render(request, 'media_add.html',
{'transaction': transaction, 'repositories': repositories,
'username': username, 'password': password})
示例9: medias_add
# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import set_current_step [as 别名]
def medias_add(request):
""" media add page """
transaction = Transaction(request)
transaction.set_current_step(Steps.MEDIAS_ADD)
if transaction.current_step()["state"] in (State.DONE, State.DISABLED):
return HttpResponseRedirect(transaction.next_step_url())
if request.method == "POST":
username = request.POST.get("username", None)
password = request.POST.get("password", None)
else:
username = None
password = None
repositories = xmlrpc.call("get_repositories", transaction.modules_list)
return render(
request,
"media_add.html",
{"transaction": transaction, "repositories": repositories, "username": username, "password": password},
)
示例10: config_valid
# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import set_current_step [as 别名]
def config_valid(request):
""" check user configuration """
transaction = Transaction(request)
transaction.set_current_step(Steps.CONFIG)
if transaction.current_step()["state"] in (State.DONE, State.DISABLED):
return HttpResponseRedirect(transaction.next_step_url())
# get forms values
config = {}
for name, value in request.POST.items():
config[name] = value
# validate values
errors = False
config = xmlrpc.call("valid_config", transaction.modules_list, config)
for conf in config:
if conf["errors"]:
errors = True
break
if errors:
return render(request, "config.html", {"config": config, "transaction": transaction})
else:
return render(request, "config_run.html", {"config": config, "transaction": transaction})