def delete_url(cls, user, uid): """delete the url""" ndbKey = ndb.Key('Endpoint', uid) query = Endpoint.query(Endpoint.owner == user.key, Endpoint.key == ndbKey).fetch() result = None if not query: return result result = query[0] result.key.delete() return result
def update_url(cls, user, project, uid, **kwds): """update the url""" ndbKey = ndb.Key('Endpoint', uid) query = Endpoint.query(Endpoint.owner == user, Endpoint.project == project, Endpoint.key == ndbKey).fetch() result = None if not query: return result result = query[0] body = cls._parse_keywords(**kwds) for key in body: setattr(result, key, body[key]) result.put() return result
def get_url(cls, user): """get the url""" query = Endpoint.query(Endpoint.owner==user.key).fetch() return query