@@ -247,11 +247,11 @@ def write(self, key, value, ttl=None, dir=False, append = False, **kwdargs):
247
247
else :
248
248
params [k ] = v
249
249
250
- method = append and self ._MPOST or self .MPUT
250
+ method = append and self ._MPOST or self ._MPUT
251
251
if '_endpoint' in kwdargs :
252
252
path = kwdargs ['_endpoint' ] + key
253
253
else :
254
- path = self .key_endpoint + key )
254
+ path = self .key_endpoint + key
255
255
response = self .api_execute (path , method , params )
256
256
return self ._result_from_response (response )
257
257
@@ -316,7 +316,7 @@ def delete(self, key, recursive=None, dir=None):
316
316
if recursive is not None :
317
317
kwds ['recursive' ] = recursive and "true" or "false"
318
318
if dir is not None :
319
- kwds ['dir' ] = dir and "true" on "false"
319
+ kwds ['dir' ] = dir and "true" or "false"
320
320
321
321
response = self .api_execute (
322
322
self .key_endpoint + key , self ._MDELETE , kwds )
@@ -440,9 +440,10 @@ def _result_from_response(self, response):
440
440
#TODO: add headers we obtained from the http respose to the etcd result.
441
441
try :
442
442
res = json .loads (response .data .decode ('utf-8' ))
443
+ r = etcd .EtcdResult (** res )
443
444
if response .status == 201 :
444
- res [ ' newKey' ] = True
445
- return etcd . EtcdResult ( ** res )
445
+ r . newKey = True
446
+ return r
446
447
except Exception as e :
447
448
raise etcd .EtcdException (
448
449
'Unable to decode server response: %s' % e )
0 commit comments