def get_network(id_or_name): if id_or_name.isdigit(): n = Network.get(id_or_name) else: n = Network.get_by_name(id_or_name) if not n: abort(404, 'Network %s not found' % id_or_name) return n
def get_network(network_id): n = Network.get(network_id) if not n: raise EruAbortException(consts.HTTP_NOT_FOUND, 'Network %s not found' % network_id) return n