This allows the get method to be able to work with remote databases. Currently calling get only returns a doc if it is in the cache. The original behavior is preserved by use of the remote parameter, consistent with other overridden methods such as keys(), therefore this should be a non-breaking change.
[ ] Added tests for code changes or test/build only changes
[x] Updated the change log file (CHANGES.md) or test/build only changes
[x] Completed the PR template below:
Description
Currently, calling the get() method on a database object returns None, even for documents I know exist in the database. This was because the method had not been overridden, therefore was only returning documents from the cache. With this change, it should now be possible to use the get() method on databases, rather than try/except blocks.
Approach
The code simply wraps a try/except block over the __getitem__ () when the remote paramaeter is True, and falls back to the original behavior by calling super if it is False.
Schema & API Changes
Updated the CouchDatabase.get() method, adding a remote parameter for that method
Security and Privacy
No Change
Testing
Existing tests should suffice for this change, because it makes no large changes, it is only a shorthand for calling an existing method.
This allows the get method to be able to work with remote databases. Currently calling get only returns a doc if it is in the cache. The original behavior is preserved by use of the
remote
parameter, consistent with other overridden methods such askeys()
, therefore this should be a non-breaking change.Checklist
CHANGES.md
) or test/build only changesDescription
Currently, calling the
get()
method on a database object returns None, even for documents I know exist in the database. This was because the method had not been overridden, therefore was only returning documents from the cache. With this change, it should now be possible to use theget()
method on databases, rather than try/except blocks.Approach
The code simply wraps a try/except block over the
__getitem__ ()
when theremote
paramaeter is True, and falls back to the original behavior by calling super if it is False.Schema & API Changes
Updated the
CouchDatabase.get()
method, adding aremote
parameter for that methodSecurity and Privacy
No Change
Testing
Existing tests should suffice for this change, because it makes no large changes, it is only a shorthand for calling an existing method.
Monitoring and Logging
No Change