def delete_role(role_id, modifier_id): query = UserRole.all() query.filter("role_id =", role_id) if query.count() > 0 : raise CoreError("The role %s is set to user, can not be deleted." % role_id) role = Role.get_by_key(int(role_id)) delete_roleoperations(role_id=role_id) role.delete(modifier_id)
def get_role(role_id=None, role_name=None): if role_id != None: role = Role.get_by_key(role_id) else: query = Role.all() query.filter("role_name =", role_name) role = query.get() return role