"""Logic for Image Status. Accesses and modifies image asset information. """ from images.models import image_assets as image_assets_model from images.models import image_status as image_status_model def get_import_asset_for_image(import_asset_id): """Get import asset information for an image. Gets the import asset that corresponds to the image. If the image upload is successful, find the image path and append to response. Args: import_asset_id (int): import_asset_id for the requested image Returns: Response: the import asset for the image. """ asset = image_status_model.get_import_asset_for_image(import_asset_id) if not asset or asset.message.get('result') != 'success': return asset asset_path = image_assets_model.get_file_path_for_image(import_asset_id) if not asset_path: return asset_path asset.message.update({'path': asset_path.message.get('path')}) return asset