Esempio n. 1
0
def load_attachment(instance_id, property_name):
    logger.debug('serving attachment \'' + property_name + '\' for instance ' + instance_id)
    attachment = Attachment(instance_id, property_name, request)
    generator = attachment.load()
    if generator is not None:
        return Response(generator(), mimetype=_BINARY_MIME, status=200)
    else:
        return Response(attachment.json_status, mimetype=_JSON_MIME, status=404)