Esempio n. 1
0
 def test_dump_load(self) :
   db.dump(t,'test.db')
   t2=tr.Tree()
   db.load(t2,'test.db')
   a=t.traverse('')
   b=t2.traverse('')
   self.assertItemsEqual(a,b) 
Esempio n. 2
0
 def test_dump_load(self) :
   db.dump(t,'test.db')
   t2=tr.Tree()
   db.load(t2,'test.db')
   a=t.traverse('')
   b=t2.traverse('')
   #print a,b
   #b = [unicode(i,'utf-8') for i in b]
   self.assertItemsEqual(a,b) 
Esempio n. 3
0
def test_dump():
 o = BaseObject('Base')
 m = MobObject('Mob')
 p = PlayerObject('Player')
 r = RoomObject('Room')
 db.dump(fname)
 l = len(db.objects)
 logger.info('Current objects: %s.', db.objects)
 db.clear()
 assert not len(db.objects)
 db.load(fname)
 assert len(db.objects) >= l, '%s (%s -> %s).' % (db.objects, len(db.objects), l)

 os.remove(fname)
 logger.info('Removed DB file: %s.', fname)
Esempio n. 4
0
def main():
    while True:
        clear()
        print(config.menu)
        ans = input(config.menu_question).lower()
        if ans == 'e':
            db.dump()
            exit()
        elif ans == 'd':
            discover()
        elif ans == 'p':
            practise()
        elif ans == 't':
            test()
        elif ans == 's':
            showstats()
Esempio n. 5
0
def return_all():
    return json.dumps(db.dump())
Esempio n. 6
0
__author__ = 'houhuihua'
__date__ = '2018.10.05'

import db
import collectapp

#initDb()
appsList = collectapp.collect_all_apps()
db.dump()

if appsList.__len__() <= 0:
    print "len = 0"
else:
    print("len = %d, app count = %d" % (appsList.__len__(), cc))

print "Great, we collect app info over..."
Esempio n. 7
0
def dump_some_cols():
    if not loggedin_staff():
        return db.error('permission denied')
    elif 'q' not in request.args:
        return db.error('missing-parameters')
    return db.dump(request.args['q'])
Esempio n. 8
0
def shutdown():
 db.dump()
 logging.info('Server shutting down.')