예제 #1
0
파일: createdb.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)
	config = setup_config(settings)

	reg = threadlocal.get_current_registry()

	factory = pyramid_mako.MakoRendererFactory()

	name_resolver = DottedNameResolver()
	lookup_opts = pyramid_mako.parse_options_from_settings(settings, 'mako.', name_resolver.maybe_resolve)
	lookup_opts.update({
		'default_filters' : ['context[\'self\'].ddl.ddl_fmt']
	})
	factory.lookup = pyramid_mako.PkgResourceTemplateLookup(**lookup_opts)

	reg.registerUtility(factory, IRendererFactory, name='.mak')

	sess = DBSession()
	mm = ModuleManager(config)

	sess.execute(SetVariable('accessuid', 0))
	sess.execute(SetVariable('accessgid', 0))
	sess.execute(SetVariable('accesslogin', '[CREATEDB]'))

	mm.scan()
	mm.install('core', sess)
	for moddef in mm.modules:
		if moddef != 'core':
			mm.install(moddef, sess)
예제 #2
0
파일: __init__.py 프로젝트: damoxc/pyjade
    def register():
        settings = config.registry.settings
        settings['{0}preprocessor'.format(mako_settings_prefix)] = preprocessor

        opts = parse_options_from_settings(settings, mako_settings_prefix, config.maybe_dotted)
        lookup = PkgResourceTemplateLookup(**opts)

        renderer_factory.lookup = lookup
예제 #3
0
    def register():
        registry = config.registry
        opts = parse_options_from_settings(
            registry.settings, settings_prefix, config.maybe_dotted)
        opts['preprocessor'] = haml.preprocessor
        lookup = PkgResourceTemplateLookup(**opts)

        renderer_factory.lookup = lookup
예제 #4
0
    def register():
        settings = config.registry.settings
        settings['{0}preprocessor'.format(mako_settings_prefix)] = preprocessor

        opts = parse_options_from_settings(settings, mako_settings_prefix, config.maybe_dotted)
        lookup = PkgResourceTemplateLookup(**opts)

        renderer_factory.lookup = lookup
예제 #5
0
파일: ctl.py 프로젝트: baloon11/npui
def setup_mako_sql(cfg):
	reg = threadlocal.get_current_registry()
	factory = pyramid_mako.MakoRendererFactory()

	name_resolver = DottedNameResolver()
	lookup_opts = pyramid_mako.parse_options_from_settings(cfg.registry.settings, 'mako.', name_resolver.maybe_resolve)
	lookup_opts.update({
		'default_filters' : ['context[\'self\'].ddl.ddl_fmt']
	})
	factory.lookup = pyramid_mako.PkgResourceTemplateLookup(**lookup_opts)

	reg.registerUtility(factory, IRendererFactory, name='.mak')
예제 #6
0
	def mako_lookup(self):
		name_resolver = DottedNameResolver()
		lookup_opts = pyramid_mako.parse_options_from_settings(
			self.cfg,
			'mako.',
			name_resolver.maybe_resolve
		)

		lookup_opts.update({
			'output_encoding' : 'utf8',
			'default_filters' : ['str']
		})
		return pyramid_mako.PkgResourceTemplateLookup(**lookup_opts)
예제 #7
0
파일: ctl.py 프로젝트: annndrey/npui
    def setup_mako_sql(self):
        if self._mako_setup:
            return
        reg = threadlocal.get_current_registry()
        factory = pyramid_mako.MakoRendererFactory()

        name_resolver = DottedNameResolver()
        lookup_opts = pyramid_mako.parse_options_from_settings(
            self.app_config.registry.settings, 'mako.',
            name_resolver.maybe_resolve)
        lookup_opts.update(
            {'default_filters': ['context[\'self\'].ddl.ddl_fmt']})
        factory.lookup = pyramid_mako.PkgResourceTemplateLookup(**lookup_opts)

        reg.registerUtility(factory, IRendererFactory, name='.mak')
        self._mako_setup = True
예제 #8
0
파일: tests.py 프로젝트: Rafails/MyCalc
 def _callFUT(self, settings, settings_prefix='mako.'):
     from pyramid_mako import parse_options_from_settings
     return parse_options_from_settings(settings, settings_prefix,
                                        self.config.maybe_dotted)
예제 #9
0
파일: tests.py 프로젝트: bmonteiro00/geru
 def _callFUT(self, settings, settings_prefix='mako.'):
     from pyramid_mako import parse_options_from_settings
     return parse_options_from_settings(settings, settings_prefix,
                                        self.config.maybe_dotted)