################################ INITIALIZE ################################## if mainAction == 'initialize': initDatabase(sqldb) sqldb.close() sys.exit(0) ################################# SECTION #################################### if mainAction == 'section': try: sectionSpec = argv[0] argv = argv[1:] except: print usage sys.exit(1) thisSection = section(sqldb) if subAction == 'create': result = thisSection.create(sectionSpec) if result == True: sys.exit(0) else: print '! %s' % result sys.exit(2) ############### FOLLOWING REQUIRES LOADING THIS SECTION ############## result = thisSection.load(sectionSpec) if True != result: print '! %s' % result sys.exit(2)
################################ INITIALIZE ################################## if mainAction == "initialize": initDatabase(sqldb) sqldb.close() sys.exit(0) ################################# SECTION #################################### if mainAction == "section": try: sectionSpec = argv[0] argv = argv[1:] except: print usage sys.exit(1) thisSection = section(sqldb) if subAction == "create": result = thisSection.create(sectionSpec) if result == True: sys.exit(0) else: print "! %s" % result sys.exit(2) ############### FOLLOWING REQUIRES LOADING THIS SECTION ############## result = thisSection.load(sectionSpec) if True != result: print "! %s" % result sys.exit(2)
from bbs.section import section from sql.sqlite import sqlite sqldb = sqlite(filename="test.sqlite") s = section(sqldb) if True != s.load('test'): print '***** Create Section *****' print s.create('test') print s.name topic = s.topic() #topic.create('first topic', 'content') print s.list(1) sqldb.close()