示例#1
0
文件: rtd.py 项目: baloon11/npui
def main(argv=sys.argv):
	if len(argv) != 2:
		usage(argv)
	config_uri = argv[1]
	setup_logging(config_uri)
	settings = get_appsettings(config_uri)
	engine = engine_from_config(settings, 'sqlalchemy.')
	DBSession.configure(bind=engine)
	cache.cache = cache.configure_cache(settings)

	config = Configurator(
		settings=settings,
		root_factory=RootFactory,
		locale_negotiator=locale_neg
	)
	config.add_route_predicate('vhost', VHostPredicate)
	config.add_view_predicate('vhost', VHostPredicate)

	mmgr = config.registry.getUtility(IModuleManager)
	mmgr.load('core')
	mmgr.load_enabled()

	rts = rt.configure(mmgr, config.registry)
	app = rts.app()
	rt.run(rts, app)
示例#2
0
 def setUp(self):
     from netprofile.common import cache
     cache.cache = cache.configure_cache(
         {'netprofile.cache.backend': 'dogpile.cache.memory'})
     self.req = testing.DummyRequest()
     self.cfg = testing.setUp(request=self.req)
     self.mm = ModuleManager(self.cfg)
     self.mod_names = ('test1', 'test2', 'empty')
     self.dict = False
示例#3
0
	def setUp(self):
		from netprofile.common import cache
		cache.cache = cache.configure_cache({
			'netprofile.cache.backend' : 'dogpile.cache.memory'
		})
		self.req = testing.DummyRequest()
		self.cfg = testing.setUp(request=self.req)
		self.mm = ModuleManager(self.cfg)
		self.mod_names = ('test1', 'test2', 'empty')
		self.dict = False
示例#4
0
文件: __init__.py 项目: baloon11/npui
def setup_config(settings):
	global inst_id

	settings['netprofile.debug'] = asbool(settings.get('netprofile.debug'))
	if 'netprofile.instance_id' in settings:
		inst_id = settings.get('netprofile.instance_id')
	engine = engine_from_config(settings, 'sqlalchemy.')
	DBSession.configure(bind=engine)
	cache.cache = cache.configure_cache(settings)

	return Configurator(
		settings=settings,
		root_factory=RootFactory,
		locale_negotiator=locale_neg
	)
示例#5
0
def setup_config(settings):
    global inst_id

    settings['netprofile.debug'] = asbool(settings.get('netprofile.debug'))
    if 'netprofile.instance_id' in settings:
        inst_id = settings.get('netprofile.instance_id')
    engine = engine_from_config(settings, 'sqlalchemy.')
    DBSession.configure(bind=engine)
    cache.cache = cache.configure_cache(settings)

    config = Configurator(settings=settings,
                          root_factory=RootFactory,
                          locale_negotiator=locale_neg)
    config.add_route_predicate('vhost', VHostPredicate)
    config.add_view_predicate('vhost', VHostPredicate)
    return config
示例#6
0
文件: __init__.py 项目: unikmhz/npui
def setup_config(settings):
    global inst_id

    settings['netprofile.debug'] = asbool(settings.get('netprofile.debug'))
    if 'netprofile.instance_id' in settings:
        inst_id = settings.get('netprofile.instance_id')
    engine = engine_from_config(settings, 'sqlalchemy.')
    DBSession.configure(bind=engine)
    cache.cache = cache.configure_cache(settings)

    config = Configurator(settings=settings,
                          root_factory=RootFactory,
                          locale_negotiator=locale_neg)
    config.add_route_predicate('vhost', VHostPredicate)
    config.add_view_predicate('vhost', VHostPredicate)
    config.include('netprofile.common.crypto')
    return config
示例#7
0
文件: genldif.py 项目: baloon11/npui
def main(argv=sys.argv):
	if len(argv) != 2:
		usage(argv)
	config_uri = argv[1]
	setup_logging(config_uri)
	settings = get_appsettings(config_uri)
	cache.cache = cache.configure_cache(settings)
	engine = engine_from_config(settings, 'sqlalchemy.')
	DBSession.configure(bind=engine)

	config = Configurator(
		settings=settings,
		root_factory=RootFactory
	)

	mmgr = config.registry.getUtility(IModuleManager)
	mmgr.load('core')
	mmgr.load_enabled()

	mb = mmgr.get_module_browser()
示例#8
0
def main(argv=sys.argv):
    if len(argv) != 2:
        usage(argv)
    config_uri = argv[1]
    setup_logging(config_uri)
    settings = get_appsettings(config_uri)
    engine = engine_from_config(settings, 'sqlalchemy.')
    DBSession.configure(bind=engine)
    cache.cache = cache.configure_cache(settings)

    config = Configurator(settings=settings,
                          root_factory=RootFactory,
                          locale_negotiator=locale_neg)
    config.add_route_predicate('vhost', VHostPredicate)
    config.add_view_predicate('vhost', VHostPredicate)
    config.commit()

    mmgr = config.registry.getUtility(IModuleManager)
    mmgr.load('core')
    mmgr.load_enabled()

    rts = rt.configure(mmgr, config.registry)
    return rt.run(rts)
示例#9
0
 def setUp(self):
     from netprofile.common import cache
     cache.cache = cache.configure_cache(
         {'netprofile.cache.backend': 'dogpile.cache.memory'})
示例#10
0
	def setUp(self):
		from netprofile.common import cache
		cache.cache = cache.configure_cache({
			'netprofile.cache.backend' : 'dogpile.cache.memory'
		})