コード例 #1
0
def main():
    """call action based on options"""
    import os, sys, conf
    (options, args) = getparser().parse_args()

    import lib.chai
    lib.chai.site = options.site or conf.default_site

    from lib.chai import db

    if options.newapp is not None:
        newapp()

    elif options.setup is not None:
        setup_db()

    elif options.update is not None:
        if options.update == 'all':
            sync_tables()
        else:
            from lib.chai import db
            db.get().sync_table(options.update)

    elif options.publish is not None:
        publish()

    elif options.adduser:
        from lib.chai import db, objstore
        db.begin()
        objstore.insert(type="user",
                        name=options.adduser[0],
                        password=options.adduser[1])
        db.commit()

    elif options.uwsgi is not None:
        from lib.chai.util import uwsgi_manager
        m = uwsgi_manager.manager('conf/uwsgi.xml')
        getattr(m, options.uwsgi)(1)

    elif options.replace is not None:
        from lib.chai.util import replacer
        # in code
        replacer.replace(conf.sites[lib.chai.site]['path'], options.replace[0], \
         options.replace[1], options.replace[2])

        # replace in framework
        replacer.replace('lib', options.replace[0], options.replace[1],
                         options.replace[2])

    elif options.concat is not None:
        concat()

    db.close()
コード例 #2
0
ファイル: __main__.py プロジェクト: jlmwebhosting/chaiproject
def main():
	"""call action based on options"""
	import os, sys, conf
	(options, args) = getparser().parse_args()
	
	import lib.chai
	lib.chai.site = options.site or conf.default_site

	from lib.chai import db

	if options.newapp is not None:
		newapp()
	
	elif options.setup is not None:
		setup_db()

	elif options.update is not None:
		if options.update=='all':
			sync_tables()
		else:
			from lib.chai import db
			db.get().sync_table(options.update)
	
	elif options.publish is not None:
		publish()
			
	elif options.adduser:
		from lib.chai import db, objstore
		db.begin()
		objstore.insert(type="user", name=options.adduser[0], password=options.adduser[1])
		db.commit()
		
	elif options.uwsgi is not None:
		from lib.chai.util import uwsgi_manager
		m = uwsgi_manager.manager('conf/uwsgi.xml')
		getattr(m, options.uwsgi)(1)

	elif options.replace is not None:
		from lib.chai.util import replacer
		# in code
		replacer.replace(conf.sites[lib.chai.site]['path'], options.replace[0], \
			options.replace[1], options.replace[2])

		# replace in framework
		replacer.replace('lib', options.replace[0], options.replace[1], options.replace[2])

	elif options.concat is not None:
		concat()

	db.close()
コード例 #3
0
 def tearDown(self):
     db.rollback()
     db.close()
コード例 #4
0
	def tearDown(self):
		db.rollback()
		db.close()