return document id without extra call
This commit is contained in:
parent
3c10815073
commit
57145534ca
1 changed files with 6 additions and 5 deletions
|
@ -866,12 +866,10 @@ class Client(object):
|
||||||
did = self.find_document(oshash)
|
did = self.find_document(oshash)
|
||||||
if not did:
|
if not did:
|
||||||
url = '%supload/document/' % self._config['url']
|
url = '%supload/document/' % self._config['url']
|
||||||
r = self.api.upload_chunks(url, f, {
|
did = self.api.upload_chunks(url, f, {
|
||||||
'filename': os.path.basename(f)
|
'filename': os.path.basename(f)
|
||||||
})
|
})
|
||||||
if r and item:
|
if did and item:
|
||||||
did = self.find_document(oshash)
|
|
||||||
if item:
|
|
||||||
r = self.api.addDocument({
|
r = self.api.addDocument({
|
||||||
'id': did,
|
'id': did,
|
||||||
'item': item
|
'item': item
|
||||||
|
@ -1210,7 +1208,10 @@ class API(ox.API):
|
||||||
print(' ' * 80)
|
print(' ' * 80)
|
||||||
print('')
|
print('')
|
||||||
show_cursor()
|
show_cursor()
|
||||||
return data and 'result' in data and data.get('result') == 1
|
if data and 'result' in data and data.get('result') == 1:
|
||||||
|
return data.get('id', True)
|
||||||
|
else:
|
||||||
|
return False
|
||||||
else:
|
else:
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
if 'status' in data and data['status']['code'] == 401:
|
if 'status' in data and data['status']['code'] == 401:
|
||||||
|
|
Loading…
Reference in a new issue