This repository was archived by the owner on May 16, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -577,12 +577,14 @@ def respond(success):
577577 @POST ('^/api/v1/upload_image' )
578578 def upload_image (self , request ):
579579 try :
580- image = request .args ["image" ][0 ]
581- hash_value = digest (image ).encode ("hex" )
582- with open (DATA_FOLDER + "store/media/" + hash_value , 'w' ) as outfile :
583- outfile .write (image )
584- self .db .HashMap ().insert (digest (image ), DATA_FOLDER + "store/media/" + hash_value )
585- request .write (hash_value )
580+ ret = []
581+ for image in request .args ["image" ]:
582+ hash_value = digest (image ).encode ("hex" )
583+ with open (DATA_FOLDER + "store/media/" + hash_value , 'w' ) as outfile :
584+ outfile .write (image )
585+ self .db .HashMap ().insert (digest (image ), DATA_FOLDER + "store/media/" + hash_value )
586+ ret .append (hash_value )
587+ request .write (json .dumps ({"success" : True , "image_hashes" : ret }, indent = 4 ))
586588 request .finish ()
587589 return server .NOT_DONE_YET
588590 except Exception , e :
Original file line number Diff line number Diff line change @@ -381,7 +381,7 @@ def add_order_confirmation(self,
381381 with open (file_path , 'w' ) as outfile :
382382 outfile .write (json .dumps (self .contract , indent = 4 ))
383383
384- def accept_order_confirmation (self , ws , confirmation_json = False ):
384+ def accept_order_confirmation (self , ws , confirmation_json = None ):
385385 """
386386 Validate the order confirmation sent over from the seller and update our node accordingly.
387387 """
Original file line number Diff line number Diff line change @@ -98,7 +98,10 @@ def on_bootstrap_complete(resp):
9898 # blockchain
9999 def height_fetched (ec , height ):
100100 print "Libbitcoin server online"
101- timeout .cancel ()
101+ try :
102+ timeout .cancel ()
103+ except Exception :
104+ pass
102105
103106 def timeout (client ):
104107 print "Libbitcoin server offline"
You can’t perform that action at this time.
0 commit comments