Code optimization

The following codes have been excuted in function '_validate_exists',
and the result has been returned. therefore it is not necessary to
excute the following code again.

get_env_template = env_temps.EnvTemplateServices.get_env_template
env_template = get_env_template(env_template_id)

Change-Id: I2aeb835b1cda1b30f4fffbbd293beb42efc78588
This commit is contained in:
chenaidong1 2017-09-16 12:05:27 +08:00
parent e38c516673
commit 12f6d0c0b3
1 changed files with 1 additions and 3 deletions

View File

@ -256,9 +256,7 @@ class Controller(object):
return template.to_dict()
def _validate_request(self, request, env_template_id):
self._validate_exists(env_template_id)
get_env_template = env_temps.EnvTemplateServices.get_env_template
env_template = get_env_template(env_template_id)
env_template = self._validate_exists(env_template_id)
if env_template.is_public or request.context.is_admin:
return
if env_template.tenant_id != request.context.tenant: