Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix-exit-method-mixin' into main…
Browse files Browse the repository at this point in the history
…tenance-updates

# Conflicts:
#	keg_elements/db/mixins.py
  • Loading branch information
guruofgentoo committed Dec 7, 2022
2 parents 747d208 + b9a00a8 commit 4d67937
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions keg_elements/db/mixins.py
Expand Up @@ -191,7 +191,7 @@ def delete_cascaded(cls):
@might_flush
@kwargs_match_entity
@classmethod
def edit(cls, oid=None, **kwargs):
def edit(cls, _oid=None, **kwargs):
"""Edit an object in session with the kwargs, and optionally flush or commit.
:param oid: the object identifier, normally the primary key
Expand All @@ -200,9 +200,9 @@ def edit(cls, oid=None, **kwargs):
:return: entity instance edited and optionally flushed/committed
"""
try:
primary_keys = oid or [kwargs.get(x.name)
for x in cls.primary_keys()
if x is not None and kwargs.get(x.name) is not None]
primary_keys = _oid or [kwargs.get(x.name)
for x in cls.primary_keys()
if x is not None and kwargs.get(x.name) is not None]
if not primary_keys:
raise KeyError
except KeyError:
Expand Down
1 change: 0 additions & 1 deletion keg_elements/i18n/babel.cfg
@@ -1,4 +1,3 @@
[python: **.py]
[jinja2: templates/**.html]
extensions=jinja2.ext.autoescape,jinja2.ext.with_
[javascript: **.js]
2 changes: 1 addition & 1 deletion keg_elements/tests/test_db_mixins.py
Expand Up @@ -104,7 +104,7 @@ def test_delete_cascaded(self):
def test_edit(self):
thing1 = ents.Thing.fake()

ents.Thing.edit(thing1.id, name='edited')
ents.Thing.edit(_oid=thing1.id, name='edited')
assert thing1.name == 'edited'

with pytest.raises(AttributeError):
Expand Down

0 comments on commit 4d67937

Please sign in to comment.