+ #calculate checksum
+ host_test_mode = True if config_dic['mode']=='test' or config_dic['mode']=="OF only" else False
+ try:
+ image_file = http_content['image'].get('path',None)
+ if os.path.exists(image_file):
+ http_content['image']['checksum'] = md5(image_file)
+ elif is_url(image_file):
+ pass
+ else:
+ if not host_test_mode:
+ content = "Image file not found"
+ print "http_post_images error: %d %s" % (HTTP_Bad_Request, content)
+ bottle.abort(HTTP_Bad_Request, content)
+ except Exception as e:
+ print "ERROR. Unexpected exception: %s" % (str(e))
+ bottle.abort(HTTP_Internal_Server_Error, type(e).__name__ + ": " + str(e))