Skip to content

Commit

Permalink
Fix content.async_get() catches KeyError exceptions unrelated to txn.…
Browse files Browse the repository at this point in the history
…get_child() (#1178)
  • Loading branch information
masipcat authored Oct 4, 2022
1 parent e2f21a3 commit cf3c992
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
6.5.0 (unreleased)
------------------

- Fix content.async_get() catches KeyError exceptions unrelated to txn.get_child()
- Deps: replace aioredis with redis-py
- Deps: updated flake8 so it won't depend on 'importlib-metadata<5'
[masipcat]
Expand Down
10 changes: 5 additions & 5 deletions guillotina/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,12 @@ async def async_get(self, key: str, default=None, suppress_events=False) -> Opti
try:
txn = self._get_transaction()
val = await txn.get_child(self, key)
if val is not None:
if not suppress_events:
await notify(ObjectLoadedEvent(val))
return val
except KeyError:
pass
val = None
if val is not None:
if not suppress_events:
await notify(ObjectLoadedEvent(val))
return val
return default

async def async_multi_get(
Expand Down

0 comments on commit cf3c992

Please sign in to comment.