def get_status_from_download(user_id, download): """Gets the status from a download object.""" gw = SystemGateway() if download.status == model.DOWNLOAD_STATUS_COMPLETE: # check if the file is actually present user = gw.get_user(user_id) try: gw.get_node(download.node_id, user.shard_id) except errors.DoesNotExist: return DOWNLOADED_NOT_PRESENT return download.status
def get_node_for_shard(node_id, shard_id): """Get the StorageNode for the specified node_id, shard_id. raise DoesNotExist if the node isn't there. """ gw = SystemGateway() return gw.get_node(node_id, shard_id)