def get(self, last_img_id): dbm = access.DBMan(LOST_CONFIG) identity = get_jwt_identity() user = dbm.get_user_by_id(identity) if not user.has_role(roles.ANNOTATOR): dbm.close_session() return "You need to be {} in order to perform this request.".format( roles.ANNOTATOR), 401 else: last_img_id = int(last_img_id) re = sia.get_next(dbm, identity, last_img_id, DATA_URL) dbm.close_session() logger.critical('++++++++++++++++++ SIA next ++++++++++++++++++') logger.critical(re) # ======================== Hangar update ======================== imid = re['image']['id'] imurl = re['image']['url'] co = get_checkout(identity) path = co['paths'] if imid not in path: path[imid] = imurl co.commit('Addding path') # =============================================================== return re
def get(self): dbm = access.DBMan(LOST_CONFIG) identity = get_jwt_identity() user = dbm.get_user_by_id(identity) if not user.has_role(roles.ANNOTATOR): dbm.close_session() return "You need to be {} in order to perform this request.".format(roles.ANNOTATOR), 401 else: last_sia_image_id = sia.get_last_image_id(dbm, identity) if last_sia_image_id: re = sia.get_next(dbm, identity, last_sia_image_id, DATA_URL) else: re = sia.get_next(dbm, identity, -1, DATA_URL) dbm.close_session() return re