コード例 #1
0
def edit_item(request, item_id, existence=False):
    item = WFItem.get(item_id)
    if not item:
        return HttpResponseNotFound()

    wf_name = "%s_editor" % item.item_type
    if existence:
        wf_name = "%s_editor_existencia" % item.item_type

    workflow = WorkFlow.view("couchflow/orig_workflows",
                             include_docs=True)[wf_name].one()

    if not workflow:
        return HttpResponseNotFound()
    workflow = clone_this_wf(workflow._id, request.user._id)

    workflow.nro_pedido = get_nro_pedido()
    workflow.visible = False
    workflow.set_enabled()
    try:
        workflow.save()
    except ResourceConflict:
        pass

    task = Task.view("couchflow/activetask",
                     include_docs=True)[workflow._id].one()
    if not existence:
        task.wfitems_ids = [item_id]
    else:
        task.base_item = item_id
    task.visible = False
    task.save()

    return HttpResponseRedirect("/couchflow/execute_task/%s/" % task._id)
コード例 #2
0
ファイル: views.py プロジェクト: GaloC/gplib
def edit_item(request, item_id, existence=False):
    item = WFItem.get(item_id)
    if not item:
        return HttpResponseNotFound()

    wf_name = "%s_editor" % item.item_type
    if existence:
        wf_name = "%s_editor_existencia" % item.item_type

    workflow = WorkFlow.view("couchflow/orig_workflows",
        include_docs=True)[wf_name].one()

    if not workflow:
        return HttpResponseNotFound()
    workflow = clone_this_wf(workflow._id, request.user._id)

    workflow.nro_pedido = get_nro_pedido()
    workflow.visible = False
    workflow.set_enabled()
    try:
        workflow.save()
    except ResourceConflict:
        pass

    task = Task.view("couchflow/activetask",
        include_docs=True)[workflow._id].one()
    if not existence:
        task.wfitems_ids = [item_id]
    else:
        task.base_item = item_id
    task.visible = False
    task.save()

    return HttpResponseRedirect("/couchflow/execute_task/%s/" % task._id)
コード例 #3
0
def exec_url(request, url_name):
    workflow = WorkFlow.view("couchflow/orig_workflows",
                             include_docs=True)[url_name].one()

    if not workflow:
        return HttpResponseNotFound()

    workflow = clone_this_wf(workflow._id, request.user._id)

    workflow.nro_pedido = get_nro_pedido()
    workflow.set_enabled()
    try:
        workflow.save()
    except ResourceConflict:
        pass
    task = Task.view("couchflow/activetask",
                     include_docs=True)[workflow._id].one()

    return HttpResponseRedirect("/couchflow/execute_task/%s/" % task._id)
コード例 #4
0
ファイル: views.py プロジェクト: GaloC/gplib
def exec_url(request, url_name):
    workflow = WorkFlow.view("couchflow/orig_workflows",
        include_docs=True)[url_name].one()

    if not workflow:
        return HttpResponseNotFound()

    workflow = clone_this_wf(workflow._id, request.user._id)

    workflow.nro_pedido = get_nro_pedido()
    workflow.set_enabled()
    try:
        workflow.save()
    except ResourceConflict:
        pass
    task = Task.view("couchflow/activetask",
        include_docs=True)[workflow._id].one()

    return HttpResponseRedirect("/couchflow/execute_task/%s/" % task._id)