def find(cls, dataset, id): entity = cls.by_id(id) if entity is None: raise NotFound("No such value ID: %s" % id) return entity
def find(cls, name): dataset = cls.by_name(name) if dataset is None: raise NotFound("No such dataset: %s" % name) return dataset
def find(cls, dataset, id): upload = cls.by_id(dataset, id) if upload is None: raise NotFound("No such upload: %s" % id) return upload
def view_by_name(dataset): dataset = Dataset.find(dataset) alias = Alias.by_name(dataset, request.args.get('name')) if alias is None: raise NotFound("No such alias: %s" % request.args.get('name')) return view(dataset.name, alias.id)
def view_by_name(dataset): dataset = Dataset.find(dataset) entity = Entity.by_name(dataset, request.args.get('name')) if entity is None: raise NotFound("No such entity: %s" % request.args.get('name')) return view(dataset.name, entity.id)
def get_key(dataset, sig): key = get_bucket().get_key(key_name(dataset, sig)) if not key: raise NotFound() return key
def object_or_404(obj): if obj is None: raise NotFound() return obj