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


Python WorkflowForm.save方法代码示例

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


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

示例1: edit_workflow

# 需要导入模块: from oozie.forms import WorkflowForm [as 别名]
# 或者: from oozie.forms.WorkflowForm import save [as 别名]
def edit_workflow(request, workflow):
  WorkflowFormSet = inlineformset_factory(Workflow, Node, form=NodeForm, max_num=0, can_order=False, can_delete=False)
  history = History.objects.filter(submitter=request.user, job=workflow).order_by('-submission_date')

  if request.method == 'POST' and Job.objects.can_edit_or_exception(request, workflow):
    try:
      workflow_form = WorkflowForm(request.POST, instance=workflow)
      actions_formset = WorkflowFormSet(request.POST, request.FILES, instance=workflow)

      if 'clone_action' in request.POST: return clone_action(request, action=request.POST['clone_action'])
      if 'delete_action' in request.POST: return delete_action(request, action=request.POST['delete_action'])
      if 'move_up_action' in request.POST: return move_up_action(request, action=request.POST['move_up_action'])
      if 'move_down_action' in request.POST: return move_down_action(request, action=request.POST['move_down_action'])

      if workflow_form.is_valid() and actions_formset.is_valid():
        workflow_form.save()
        actions_formset.save()

        if workflow.has_cycle():
          raise PopupException(_('Sorry, this operation is not creating a cycle which would break the workflow.'))

        request.info(_("Workflow saved!"))
        return redirect(reverse('oozie:edit_workflow', kwargs={'workflow': workflow.id}))
    except Exception, e:
      request.error(_('Sorry, this operation is not supported: %(error)s') % {'error': e})
开发者ID:kthguru,项目名称:hue,代码行数:27,代码来源:editor.py

示例2: create_workflow

# 需要导入模块: from oozie.forms import WorkflowForm [as 别名]
# 或者: from oozie.forms.WorkflowForm import save [as 别名]
def create_workflow(request):
    workflow = Workflow.objects.new_workflow(request.user)

    if request.method == "POST":
        workflow_form = WorkflowForm(request.POST, instance=workflow)

        if workflow_form.is_valid():
            wf = workflow_form.save()
            Workflow.objects.initialize(wf, request.fs)
            return redirect(reverse("oozie:edit_workflow", kwargs={"workflow": workflow.id}))
        else:
            request.error(_("Errors on the form: %s") % workflow_form.errors)
    else:
        workflow_form = WorkflowForm(instance=workflow)

    return render("editor/create_workflow.mako", request, {"workflow_form": workflow_form, "workflow": workflow})
开发者ID:romainr,项目名称:hue,代码行数:18,代码来源:editor.py

示例3: create_workflow

# 需要导入模块: from oozie.forms import WorkflowForm [as 别名]
# 或者: from oozie.forms.WorkflowForm import save [as 别名]
def create_workflow(request):
  workflow = Workflow.objects.new_workflow(request.user)

  if request.method == 'POST':
    workflow_form = WorkflowForm(request.POST, instance=workflow)

    if workflow_form.is_valid():
      wf = workflow_form.save()
      wf.managed = True
      Workflow.objects.initialize(wf, request.fs)
      return redirect(reverse('oozie:edit_workflow', kwargs={'workflow': workflow.id}))
  else:
    workflow_form = WorkflowForm(instance=workflow)

  return render('editor/create_workflow.mako', request, {
    'workflow_form': workflow_form,
    'workflow': workflow,
  })
开发者ID:18600597055,项目名称:hue,代码行数:20,代码来源:editor.py


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