Esempio n. 1
0
def call_script_test():
    root = Table(fname=db_filename)
    #try:
    root.contacts.sayhi()
    #except:
    #    print 'sayhi script not found!'
    root.close()
Esempio n. 2
0
def add_test():
    print '[ Add Test ]'

    root = Table(fname=db_filename)
    root.contacts.amy = {
        'name': 'Amy',
    }
    root.contacts.sayhi = Script("print '****** ****** Hello world from database script! ****** ******'")
    root.close()
Esempio n. 3
0
def write_test():
    print '[ Write Test ]'

    root = Table(fname=db_filename)
    root.records = [
        {'url': 'www.python.org', 'name': 'Python Website'},
        {'url': 'www.cnn.com', 'name': 'Cable News Network'},
    ]
    root.contacts = Table()
    root.contacts.isaac = {
        'name': 'Isaac',
    }
    root.close()
Esempio n. 4
0
def read_test():
    print '[ Read Test ]'

    root = Table(fname=db_filename)
    try:
        print 'records: ' + str(root.records)
    except:
        print 'Records item not found!'
    
    try:
        print 'isaac: ' + str(root.contacts.isaac)
    except:
        print 'Isaac contact not found!'
    
    try:
        print 'amy: ' + str(root.contacts.amy)
    except:
        print 'Amy contact not found!'
    root.close()