Skip to content

Commit 48dca0d

Browse files
committed
[IMP] auth_api_key: pre-commit auto fixes
1 parent b0c7a06 commit 48dca0d

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

auth_api_key/models/auth_api_key.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2018 ACSONE SA/NV
22
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
33

4-
from odoo import _, api, fields, models, tools
4+
from odoo import api, fields, models, tools
55
from odoo.exceptions import AccessError, ValidationError
66
from odoo.tools import consteq
77

@@ -39,11 +39,13 @@ def _retrieve_api_key(self, key):
3939
@tools.ormcache("key")
4040
def _retrieve_api_key_id(self, key):
4141
if not self.env.user.has_group("base.group_system"):
42-
raise AccessError(_("User is not allowed"))
43-
for api_key in self.search([]):
42+
raise AccessError(self.env._("User is not allowed"))
43+
for api_key in self.search([], limit=None):
4444
if api_key.key and consteq(key, api_key.key):
4545
return api_key.id
46-
raise ValidationError(_(f"The key {key} is not allowed"))
46+
raise ValidationError(
47+
self.env._("The key {key} is not allowed").format(key=key)
48+
)
4749

4850
@api.model
4951
@tools.ormcache("key")

0 commit comments

Comments
 (0)