Пример #1
0
def get_test_jobs(args):
    dbsession = models.get_session()
    TJ = models.TestJob
    for jobid in args:
        try:
            jobid = int(jobid)
        except ValueError:
            pass
        try:
            if type(jobid) is int:
                testjob = dbsession.query(TJ).get(jobid)
            else:
                testjob = dbsession.query(TJ).filter(TJ.name==jobid).one()
        except models.NoResultFound:
            logging.warn("No TestJob with id %r" % jobid)
            continue
        else:
            yield testjob
Пример #2
0
def main(argv):
    """dbedit [-d]
    """
    debug = 0
    try:
        optlist, longopts, args = getopt.getopt(argv[1:], "?hdD")
    except getopt.GetoptError:
        print((main.__doc__))
        return
    for opt, val in optlist:
        if opt in ("-?", "-h"):
            print((main.__doc__))
            return
        elif opt == "-d":
            debug += 1
        elif opt == "-D":
            from pycopia import autodebug

    sess = models.get_session()
    try:
        app = DBEditor(sess, debug)
        try:
            app.run()
        except:
            if debug:
                ex, val, tb = sys.exc_info()
                from pycopia import debugger
                if debug > 1:
                    from pycopia import IOurxvt
                    io = IOurxvt.UrxvtIO()
                else:
                    io = None
                debugger.post_mortem(tb, ex, val, io)
                if debug > 1:
                    io.close()
            else:
                raise
    finally:
        sess.close()
Пример #3
0
def main(argv):
    """dbedit [-d]
    """
    debug = 0
    try:
        optlist, longopts, args = getopt.getopt(argv[1:], "?hdD")
    except getopt.GetoptError:
            print((main.__doc__))
            return
    for opt, val in optlist:
        if opt in ("-?", "-h"):
            print((main.__doc__))
            return
        elif opt == "-d":
            debug += 1
        elif opt == "-D":
            from pycopia import autodebug

    sess = models.get_session()
    try:
        app = DBEditor(sess, debug)
        try:
            app.run()
        except:
            if debug:
                ex, val, tb = sys.exc_info()
                from pycopia import debugger
                if debug > 1:
                    from pycopia import IOurxvt
                    io = IOurxvt.UrxvtIO()
                else:
                    io = None
                debugger.post_mortem(tb, ex, val, io)
                if debug > 1:
                    io.close()
            else:
                raise
    finally:
        sess.close()