def save_system(self, **kw): try: with convert_db_lookup_error('No such system: %s' % kw['system']['text']): system = System.by_fqdn(kw['system']['text'], identity.current.user) except DatabaseLookupError, e: flash(unicode(e)) redirect("./edit?group_id=%s" % kw['group_id'])
def by_id(cls, id, valid=None): with convert_db_lookup_error('No such task with ID: %s' % id): query = cls.query.filter(Task.id == id) if valid is not None: query = query.filter(Task.valid == bool(valid)) return query.one()
def by_name(cls, name, valid=None): with convert_db_lookup_error('No such task: %s' % name): query = cls.query.filter(cls.name == name) if valid is not None: query = query.filter(Task.valid == bool(valid)) return query.one()
def by_id(cls, id): with convert_db_lookup_error('No group with ID: %s' % id): return cls.query.filter_by(group_id=id).one()
def by_name(cls, name): with convert_db_lookup_error('No such distro: %s' % name): return cls.query.filter_by(name=name).one()
def by_id(cls, id, valid=None): with convert_db_lookup_error('No such task with ID: %s' % id): query = cls.query.filter(Task.id==id) if valid is not None: query = query.filter(Task.valid==bool(valid)) return query.one()
def by_name(cls, name, valid=None): with convert_db_lookup_error('No such task: %s' % name): query = cls.query.filter(cls.name == name) if valid is not None: query = query.filter(Task.valid==bool(valid)) return query.one()