apply new linter
This commit is contained in:
parent
4f568f7068
commit
a7fe3ed608
|
|
@ -44,14 +44,14 @@ class EncryptedData(models.Model):
|
|||
cipher = self._get_cipher(env)
|
||||
try:
|
||||
return cipher.decrypt(self.encrypted_data).decode()
|
||||
except InvalidToken:
|
||||
except InvalidToken as err:
|
||||
raise ValidationError(
|
||||
_(
|
||||
"Password has been encrypted with a different "
|
||||
"key. Unless you can recover the previous key, "
|
||||
"this password is unreadable."
|
||||
)
|
||||
)
|
||||
) from err
|
||||
|
||||
@api.model
|
||||
@ormcache("self._uid", "name", "env")
|
||||
|
|
@ -77,10 +77,10 @@ class EncryptedData(models.Model):
|
|||
return {}
|
||||
try:
|
||||
return json.loads(data)
|
||||
except (ValueError, TypeError):
|
||||
except (ValueError, TypeError) as err:
|
||||
raise ValidationError(
|
||||
_("The data you are trying to read are not in a json format")
|
||||
)
|
||||
) from err
|
||||
|
||||
@staticmethod
|
||||
def _retrieve_env():
|
||||
|
|
|
|||
|
|
@ -118,7 +118,9 @@ def _load_config_from_server_env_files(config_p):
|
|||
try:
|
||||
config_p.read(conf_files)
|
||||
except Exception as e:
|
||||
raise Exception('Cannot read config files "{}": {}'.format(conf_files, e))
|
||||
raise Exception(
|
||||
'Cannot read config files "{}": {}'.format(conf_files, e)
|
||||
) from e
|
||||
|
||||
|
||||
def _load_config_from_rcfile(config_p):
|
||||
|
|
@ -135,7 +137,7 @@ def _load_config_from_env(config_p):
|
|||
except configparser.Error as err:
|
||||
raise Exception(
|
||||
"{} content could not be parsed: {}".format(varname, err)
|
||||
)
|
||||
) from err
|
||||
|
||||
|
||||
def _load_config():
|
||||
|
|
|
|||
|
|
@ -105,9 +105,7 @@ class ServerEnvMixin(models.AbstractModel):
|
|||
<strong>{}</strong>
|
||||
</div>
|
||||
</div>
|
||||
""".format(
|
||||
"alert-danger", warning_string
|
||||
)
|
||||
""".format("alert-danger", warning_string)
|
||||
)
|
||||
return elem
|
||||
|
||||
|
|
@ -120,9 +118,7 @@ class ServerEnvMixin(models.AbstractModel):
|
|||
type="object" string="{}{}"
|
||||
class="btn btn-lg btn-primary ml-2"
|
||||
context="{}"/>
|
||||
""".format(
|
||||
button_string, environment, {"environment": environment}
|
||||
)
|
||||
""".format(button_string, environment, {"environment": environment})
|
||||
button_div += "{}".format(button)
|
||||
button_div += "</div>"
|
||||
alert_string = _("Modify values for {} environment").format(current_env)
|
||||
|
|
@ -137,9 +133,7 @@ class ServerEnvMixin(models.AbstractModel):
|
|||
</div>
|
||||
{}
|
||||
</div>
|
||||
""".format(
|
||||
alert_type, alert_string, button_div
|
||||
)
|
||||
""".format(alert_type, alert_string, button_div)
|
||||
)
|
||||
return elem
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ SECTION = "ir.config_parameter"
|
|||
|
||||
|
||||
class IrConfigParameter(models.Model):
|
||||
|
||||
_inherit = "ir.config_parameter"
|
||||
|
||||
is_environment = fields.Boolean(
|
||||
|
|
|
|||
Loading…
Reference in New Issue