Skip to content

Commit

Permalink
apply new linter
Browse files Browse the repository at this point in the history
  • Loading branch information
petrus-v committed Dec 19, 2023
1 parent 4f568f7 commit a7fe3ed
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
8 changes: 4 additions & 4 deletions data_encryption/models/encrypted_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ def _decrypt_data(self, env):
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")
Expand All @@ -77,10 +77,10 @@ def _encrypted_read_json(self, name, env=None):
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():
Expand Down
6 changes: 4 additions & 2 deletions server_environment/server_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(

Check warning on line 121 in server_environment/server_env.py

View check run for this annotation

Codecov / codecov/patch

server_environment/server_env.py#L121

Added line #L121 was not covered by tests
'Cannot read config files "{}": {}'.format(conf_files, e)
) from e


def _load_config_from_rcfile(config_p):
Expand All @@ -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():
Expand Down
12 changes: 3 additions & 9 deletions server_environment_data_encryption/models/server_env_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ def _get_extra_environment_info_div(self, current_env, extra_envs):
<strong>{}</strong>
</div>
</div>
""".format(
"alert-danger", warning_string
)
""".format("alert-danger", warning_string)
)
return elem

Expand All @@ -120,9 +118,7 @@ def _get_extra_environment_info_div(self, current_env, extra_envs):
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)
Expand All @@ -137,9 +133,7 @@ def _get_extra_environment_info_div(self, current_env, extra_envs):
</div>
{}
</div>
""".format(
alert_type, alert_string, button_div
)
""".format(alert_type, alert_string, button_div)
)
return elem

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


class IrConfigParameter(models.Model):

_inherit = "ir.config_parameter"

is_environment = fields.Boolean(
Expand Down

0 comments on commit a7fe3ed

Please sign in to comment.