当前位置: 首页>>代码示例>>Python>>正文


Python Transaction.current_step方法代码示例

本文整理汇总了Python中transaction.Transaction.current_step方法的典型用法代码示例。如果您正苦于以下问题:Python Transaction.current_step方法的具体用法?Python Transaction.current_step怎么用?Python Transaction.current_step使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在transaction.Transaction的用法示例。


在下文中一共展示了Transaction.current_step方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: config

# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import 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'))
开发者ID:figarocorso,项目名称:mss,代码行数:29,代码来源:views.py

示例2: download

# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import 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})
开发者ID:figarocorso,项目名称:mss,代码行数:9,代码来源:views.py

示例3: medias_auth

# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import 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})
开发者ID:figarocorso,项目名称:mss,代码行数:10,代码来源:views.py

示例4: preinst

# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import 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})
开发者ID:figarocorso,项目名称:mss,代码行数:10,代码来源:views.py

示例5: install

# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import 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})
开发者ID:figarocorso,项目名称:mss,代码行数:12,代码来源:views.py

示例6: medias_add

# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import 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})
开发者ID:figarocorso,项目名称:mss,代码行数:21,代码来源:views.py

示例7: medias_add

# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import 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},
    )
开发者ID:jfmorcillo,项目名称:mss,代码行数:23,代码来源:views.py

示例8: config_valid

# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import 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})
开发者ID:jfmorcillo,项目名称:mss,代码行数:24,代码来源:views.py


注:本文中的transaction.Transaction.current_step方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。