diff options
author | Sawyer Bergeron <sbergeron@iol.unh.edu> | 2019-07-01 15:17:52 -0400 |
---|---|---|
committer | Sawyer Bergeron <sbergeron@iol.unh.edu> | 2019-07-02 08:22:36 -0400 |
commit | 08ed74b95826a907ba8f9797002ef98eb2e82424 (patch) | |
tree | f4dc0936b418fed16a6e18f3338a5b6760d241bf /src/workflow/sw_bundle_workflow.py | |
parent | 8149a888fe6f7c1c3b1b3be2b3996c6d225d5a53 (diff) |
add post to steps (LAAS-32)
Change-Id: I3fa53c399f914d7daa8ffb5d8640a153de555421
Signed-off-by: Sawyer Bergeron <sbergeron@iol.unh.edu>
Diffstat (limited to 'src/workflow/sw_bundle_workflow.py')
-rw-r--r-- | src/workflow/sw_bundle_workflow.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/workflow/sw_bundle_workflow.py b/src/workflow/sw_bundle_workflow.py index 0c558fc..4dc0b8e 100644 --- a/src/workflow/sw_bundle_workflow.py +++ b/src/workflow/sw_bundle_workflow.py @@ -104,7 +104,7 @@ class Define_Software(WorkflowStep): return context - def post_render(self, request): + def post(self, post_data, user): models = self.repo_get(self.repo.CONFIG_MODELS, {}) if "bundle" not in models: models['bundle'] = ConfigBundle(owner=self.repo_get(self.repo.SESSION_USER)) @@ -112,8 +112,8 @@ class Define_Software(WorkflowStep): confirm = self.repo_get(self.repo.CONFIRMATION, {}) hosts = self.get_host_list() - models['headnode_index'] = request.POST.get("headnode", 1) - formset = self.create_hostformset(hosts, data=request.POST) + models['headnode_index'] = post_data.get("headnode", 1) + formset = self.create_hostformset(hosts, data=post_data) has_headnode = False if formset.is_valid(): models['host_configs'] = [] @@ -140,7 +140,7 @@ class Define_Software(WorkflowStep): if not has_headnode: self.set_invalid('Must have one "Headnode" per POD') - return self.render(request) + return self.repo_put(self.repo.CONFIG_MODELS, models) if "configuration" not in confirm: @@ -151,8 +151,6 @@ class Define_Software(WorkflowStep): else: self.set_invalid("Please complete all fields") - return self.render(request) - class Config_Software(WorkflowStep): template = 'config_bundle/steps/config_software.html' @@ -172,7 +170,7 @@ class Config_Software(WorkflowStep): context["form"] = BasicMetaForm(initial=initial) return context - def post_render(self, request): + def post(self, post_data, user): models = self.repo_get(self.repo.CONFIG_MODELS, {}) if "bundle" not in models: models['bundle'] = ConfigBundle(owner=self.repo_get(self.repo.SESSION_USER)) @@ -181,7 +179,7 @@ class Config_Software(WorkflowStep): if "configuration" not in confirm: confirm['configuration'] = {} - form = BasicMetaForm(request.POST) + form = BasicMetaForm(post_data) if form.is_valid(): models['bundle'].name = form.cleaned_data['name'] models['bundle'].description = form.cleaned_data['description'] @@ -194,5 +192,3 @@ class Config_Software(WorkflowStep): self.repo_put(self.repo.CONFIG_MODELS, models) self.repo_put(self.repo.CONFIRMATION, confirm) - - return self.render(request) |