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