Esempio n. 1
0
def _pushpages(pages):
    tdb.transact()
    try:
        for p in pages.values():
            print('saving', p.name)
            _savepage(p)
    except:
        tdb.rollback()
        raise
    else:
        tdb.commit()
Esempio n. 2
0
def _pushpages(pages):
    tdb.transact()
    try:
        for p in pages.values(): 
            print 'saving', p.name
            _savepage(p)    
    except:
        tdb.rollback()
        raise
    else:
        tdb.commit()
Esempio n. 3
0
def dataload(filename):
    """Loads data dumped using datadump action into the database."""
    lines = open(filename).xreadlines()
    tdb.transact()
    try:
        for line in lines:
            data = storify(eval(line))
            _savepage(data)
    except:
        tdb.rollback()
        raise
    else:
        tdb.commit()
Esempio n. 4
0
def dataload(filename):
    """"Loads data dumped using datadump action into the database."""
    lines = open(filename).xreadlines()
    tdb.transact()
    try:
        for line in lines:
            data = storify(eval(line))
            _savepage(data)
    except:
        tdb.rollback()
        raise
    else:
        tdb.commit()
Esempio n. 5
0
def apply_upgrades():
    from infogami import tdb
    tdb.transact()
    try:
        v = get_db_version()
        for u in upgrades[v:]:
            print >> web.debug, 'applying upgrade:', u.__name__
            u()

        mark_upgrades()
        tdb.commit()
        print >> web.debug, 'upgrade successful.'
    except:
        print >> web.debug, 'upgrade failed'
        import traceback
        traceback.print_exc()
        tdb.rollback()
Esempio n. 6
0
def apply_upgrades():
    from infogami import tdb
    tdb.transact()
    try:
        v = get_db_version()
        for u in upgrades[v:]:
            print >> web.debug, 'applying upgrade:', u.__name__
            u()
        
        mark_upgrades()
        tdb.commit()
        print >> web.debug, 'upgrade successful.'
    except:
        print >> web.debug, 'upgrade failed'
        import traceback
        traceback.print_exc()
        tdb.rollback()