Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Commit 9f950ed

Browse files
committed
Handle hash in dictionary
1 parent 85eebbd commit 9f950ed

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

orbitdbapi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.2.0.rc.1.2'
1+
__version__ = '0.2.0.rc.1.3'

orbitdbapi/db.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,17 @@ def put(self, item, cache=None):
124124
if index_val:
125125
self.__cache[index_val] = item
126126
endpoint = '/'.join(['db', self.__id_safe, 'put'])
127-
entry_hash = self.__client._call('post', endpoint, item)
128-
if cache: self.__cache[entry_hash] = item
127+
entry_hash = self.__client._call('post', endpoint, item).get('hash')
128+
if cache and entry_hash: self.__cache[entry_hash] = item
129129
return entry_hash
130130

131131
def add(self, item, cache=None):
132132
if self.__enforce_caps and not self.addable:
133133
raise CapabilityError('Db {} does not have add capability'.format(self.__dbname))
134134
if cache is None: cache = self.__use_cache
135135
endpoint = '/'.join(['db', self.__id_safe, 'add'])
136-
entry_hash = self.__client._call('post', endpoint, item)
137-
if cache: self.__cache[entry_hash] = item
136+
entry_hash = self.__client._call('post', endpoint, item).get('hash')
137+
if cache and entry_hash: self.__cache[entry_hash] = item
138138
return entry_hash
139139

140140
def iterator_raw(self, **kwargs):

0 commit comments

Comments
 (0)