Commit af9b6351 authored by sebastien letort's avatar sebastien letort
Browse files

a new method for webapp to get the tuple status (id,string) of the state of webapp.

I updated a debug message to use it.
parent 93eec9a5
Pipeline #72578 failed with stage
in 1 second
......@@ -307,6 +307,15 @@ class Webapp(TimeStampModel):
query = query.filter(number=number)
return query.order_by("-state", "-id").first()
def get_sandbox_state(self):
for i,s in self.SANDBOX_STATE_CHOICES:
if i == self.sandbox_state:
return i,s
msg = "The current state {} is not defined in the model." \
raise ValueError(msg)
class WebappParameter(TimeStampModel):
......@@ -721,7 +721,7 @@ class WebappSandboxPanel(UserAccessMixin, TemplateView):
messages.success(request, "stopping sandbox %r" %
log.debug("new sandbox state: %r -> %r",
webapp.docker_name, webapp.sandbox_state)
webapp.docker_name, webapp.get_sandbox_state())
# NOTE: we return a 302 redirect to the same page (instead of rendering
# it directly) to force the browser to make a separate GET request.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment