Example #1
0
 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'])
Example #2
0
 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()
Example #3
0
 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()
Example #4
0
 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()
Example #5
0
 def by_name(cls, name):
     with convert_db_lookup_error('No such distro: %s' % name):
         return cls.query.filter_by(name=name).one()
Example #6
0
 def by_name(cls, name):
     with convert_db_lookup_error('No such distro: %s' % name):
         return cls.query.filter_by(name=name).one()
Example #7
0
 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()
Example #8
0
 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()
Example #9
0
 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()