-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed: ZODB.Connection.TransactionMetaData didn't custom data #132
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1321,3 +1321,22 @@ def _extension(self): | |
@_extension.setter | ||
def _extension(self, v): | ||
self.extension = v | ||
|
||
def data(self, ob): | ||
try: | ||
data = self._data | ||
except AttributeError: | ||
raise KeyError(ob) | ||
|
||
try: | ||
return data[id(ob)] | ||
except KeyError: | ||
raise KeyError(ob) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this simpler and equivalent (fewer lines of code to cover)? try:
return self._data[id(ob)]
except (AttributeError, KeyError):
raise KeyError(ob) Not that it's a big deal. If you prefer the more explicit version that's fine by me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. This code was copied verbatim from transaction. |
||
|
||
def set_data(self, ob, ob_data): | ||
try: | ||
data = self._data | ||
except AttributeError: | ||
data = self._data = {} | ||
|
||
data[id(ob)] = ob_data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing some words?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup