当前位置: 首页>>代码示例>>Python>>正文


Python Configurator.register_resource方法代码示例

本文整理汇总了Python中pyramid.config.Configurator.register_resource方法的典型用法代码示例。如果您正苦于以下问题:Python Configurator.register_resource方法的具体用法?Python Configurator.register_resource怎么用?Python Configurator.register_resource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyramid.config.Configurator的用法示例。


在下文中一共展示了Configurator.register_resource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import register_resource [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    settings['route_patterns'] = {
        'languages': '/language',
        'language': '/language/{id:[^/\.]+}',
        'unit': '/word/{id:[^/\.]+}',
        'parameters': '/meaning',
        'parameter': '/meaning/{id:[^/\.]+}',
        'contributions': '/vocabulary',
        'contribution': '/vocabulary/{id:[^/\.]+}',
        'contributors': '/contributor',
        'contributor': '/contributor/{id:[^/\.]+}',
        'semanticfields': '/semanticfield',
        'semanticfield': '/semanticfield/{id:[^/\.]+}',
        'legal': '/about/legal',
    }
    config = Configurator(settings=settings)
    config.include('clldmpg')
    config.registry.registerUtility(WoldMapMarker(), IMapMarker),
    config.register_resource(
        'semanticfield', SemanticField, ISemanticField, with_index=True)
    config.register_download(N3(Dataset, 'wold2', description="RDF dump"))
    config.register_download(N3Dump(Parameter, 'wold2', description="Meanings as RDF"))
    return config.make_wsgi_app()
开发者ID:pombredanne,项目名称:wold2,代码行数:27,代码来源:__init__.py

示例2: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import register_resource [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    convert = lambda spec: ''.join(c if i == 0 else c + c for i, c in enumerate(spec))
    filename_pattern = re.compile('(?P<spec>(c|d|s|f|t)[0-9a-f]{3})\.png')
    icons = []
    for name in sorted(
            [fn.name for fn in
             Path(__file__).parent.joinpath('static', 'icons').glob('*.png')]):
        m = filename_pattern.match(name)
        if m:
            icons.append(Icon(convert(m.group('spec'))))

    config = Configurator(settings=settings)
    config.include('clldmpg')
    config.registry.registerUtility(map_marker, IMapMarker)
    config.registry.registerUtility(icons, IIconList)
    config.register_adapter(adapter_factory(
        'parameter/detail_tab.mako',
        mimetype='application/vnd.clld.tab',
        send_mimetype="text/plain",
        extension='tab',
        name='tab-separated values'), IParameter)
    #config.register_resource('construction', models.sailsUnit, IUnit, with_index=True)
    config.register_resource('construction', models.sailsConstruction, IConstruction, with_index=True)
    #config.register_adapter(adapter_factory('family/detail_html.mako'), IFamily)
    return config.make_wsgi_app()
开发者ID:clld,项目名称:sails,代码行数:29,代码来源:__init__.py

示例3: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import register_resource [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    config = Configurator(settings=settings)
    config.include('clldmpg')
    config.include('clld_glottologfamily_plugin')
    config.registry.registerUtility(MyMapMarker(), IMapMarker)
    config.register_resource('cognateset', models.Cognateset, ICognateset)
    return config.make_wsgi_app()
开发者ID:pombredanne,项目名称:lexibank,代码行数:11,代码来源:__init__.py

示例4: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import register_resource [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    config = Configurator(settings=settings)
    config.include('clldlucl')
    config.include('clld_glottologfamily_plugin')
    config.registry.registerUtility(MyMapMarker(), IMapMarker)
    config.registry.registerUtility(LexiRumahCtxFactoryQuery(), ICtxFactoryQuery)
    config.register_resource('cognateset', models.Cognateset, ICognateset, with_index=True)
    return config.make_wsgi_app()
开发者ID:Anaphory,项目名称:lexibank,代码行数:12,代码来源:__init__.py

示例5: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import register_resource [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    config = Configurator(settings=settings)
    config.include('clldlucl')
    config.include('clld_glottologfamily_plugin')
    
    config.registry.settings['home_comp'].append('coverage')
    config.add_route('coverage', pattern='/coverage')
    config.add_view(views.coverage, route_name='coverage', renderer='coverage.mako')

    #config.registry.settings['home_comp'].append('stability')
    #config.add_route('stability', pattern='/stability')
    #config.add_view(views.stability, route_name='stability', renderer='stability.mako')

    #config.registry.settings['home_comp'].append('dependencies')
    #config.add_route('dependencies', pattern='/dependencies')
    #config.add_view(views.dependencies, route_name='dependencies', renderer='dependencies.mako')
    
    config.register_resource('dependency', Dependency, IDependency, with_index=True)
    config.register_resource('transition', Transition, ITransition, with_index=True)
    config.register_resource('stability', Stability, IStability, with_index=True)
    config.register_resource('deepfamily', DeepFamily, IDeepFamily, with_index=True)
    config.register_resource('support', Support, ISupport, with_index=True)

    config.registry.registerUtility(MyMapMarker(), IMapMarker)

    config.registry.registerUtility(link_attrs, ILinkAttrs)
    config.register_datatable('familys', Families)
    return config.make_wsgi_app()
开发者ID:Anaphory,项目名称:culturebank,代码行数:32,代码来源:__init__.py

示例6: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import register_resource [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    settings['route_patterns'] = {'walss': '/wals', 'wals': '/wals/{id:[^/\.]+}'}
    config = Configurator(settings=settings)
    config.include('clldmpg')
    config.registry.registerUtility(ApicsCtxFactoryQuery(), ICtxFactoryQuery)
    config.registry.registerUtility(ApicsMapMarker(), IMapMarker)
    config.registry.registerUtility(link_attrs, ILinkAttrs)
    config.register_menu(
        ('dataset', partial(menu_item, 'dataset', label='Home')),
        ('contributions', partial(menu_item, 'contributions')),
        ('parameters', partial(menu_item, 'parameters')),
        ('apics_wals', lambda ctx, rq: (rq.route_url('walss'), u'WALS\u2013APiCS')),
        ('surveys', partial(menu_item, 'surveys')),
        ('sentences', partial(menu_item, 'sentences')),
        ('sources', partial(menu_item, 'sources')),
        ('contributors', partial(menu_item, 'contributors')),
    )
    config.register_adapter(
        {
            "base": Representation,
            "mimetype": 'application/vnd.clld.chapter+html',
            "send_mimetype": "text/html",
            "extension": 'chapter.html',
            "template": 'parameter/chapter_html.mako',
        },
        IParameter,
        name="application/vnd.clld.chapter+html")

    config.register_download(CsvDump(
        common.Language, 'apics', description="Languages as CSV"))
    config.register_download(N3Dump(
        common.Language, 'apics', description="Languages as RDF"))
    config.register_download(Download(
        common.Source, 'apics', ext='bib', description="Sources as BibTeX"))

    config.register_resource('wals', Wals, IWals, with_index=True)
    config.register_resource('survey', Survey, ISurvey, with_index=True)

    config.register_adapters([(
            ISurvey,
            Representation,
            'application/vnd.clld.md+xml',
            'md.html',
            'md_html.mako',
            {'rel': 'describedby'})])

    return config.make_wsgi_app()
开发者ID:clld,项目名称:apics,代码行数:51,代码来源:__init__.py

示例7: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import register_resource [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    config = Configurator(settings=settings)
    config.include('clldmpg')
    config.registry.registerUtility(LanguageByFamilyMapMarker(), IMapMarker)
    config.registry.registerUtility(link_attrs, ILinkAttrs)
    config.registry.registerUtility(IDSCldfConfig(), ICldfConfig)
    config.register_adapter(adapter_factory(
        'contribution/detail_tab.mako',
        mimetype='application/vnd.clld.tab',
        send_mimetype="text/plain",
        extension='tab',
        name='tab-separated values'), IContribution)
    config.register_resource('chapter', models.Chapter, IChapter, with_index=True)
    return config.make_wsgi_app()
开发者ID:clld,项目名称:ids,代码行数:18,代码来源:__init__.py

示例8: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import register_resource [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    settings['sitemaps'] = 'pair parameter source'.split()
    config = Configurator(settings=settings)
    config.include('clldmpg')
    config.registry.registerUtility(waabMapMarker(), IMapMarker)
    config.register_resource('pair', models.Pair, IPair, with_index=True)
    config.register_menu(
        ('dataset', partial(menu_item, 'dataset', label='Home')),
        ('about', lambda c, r: (r.route_url('about'), 'About')),
        ('languages', partial(menu_item, 'languages')),
        ('pairs', partial(menu_item, 'pairs')),
        ('parameters', partial(menu_item, 'parameters')),
        ('sources', partial(menu_item, 'sources')),
    )
    config.register_download(Download(
        Source, 'waab', ext='bib', description="Sources as BibTeX"))

    return config.make_wsgi_app()
开发者ID:clld,项目名称:waab,代码行数:22,代码来源:__init__.py

示例9: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import register_resource [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    config = Configurator(settings=settings)
    config.include('clldmpg')
    config.registry.registerUtility(TsammalexMapMarker(), IMapMarker)
    config.registry.settings['home_comp'].append('contributors')
    config.register_menu(
        ('dataset', dict(label='Home')),
        'values',
        'languages',
        'parameters',
        'ecoregions',
        'sources',
        'images',
        #('contributors', dict(label='Contribute'))
        ('contribute', lambda ctx, req: (req.route_url('help'), 'Contribute!'))
    )
    config.register_resource('ecoregion', models.Ecoregion, IEcoregion, with_index=True)
    config.register_resource('image', Parameter_files, IImage, with_index=True)
    return config.make_wsgi_app()
开发者ID:afehn,项目名称:tsammalex,代码行数:23,代码来源:__init__.py

示例10: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import register_resource [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    settings['route_patterns'] = {'walss': '/wals', 'wals': '/wals/{id:[^/\.]+}'}
    config = Configurator(settings=settings)
    config.include('clldmpg')
    config.registry.registerUtility(ApicsCtxFactoryQuery(), ICtxFactoryQuery)
    config.registry.registerUtility(ApicsMapMarker(), IMapMarker)
    config.registry.registerUtility(frequency_marker, IFrequencyMarker)
    config.registry.registerUtility(link_attrs, ILinkAttrs)
    config.register_menu(
        ('dataset', partial(menu_item, 'dataset', label='Home')),
        ('contributions', partial(menu_item, 'contributions')),
        ('parameters', partial(menu_item, 'parameters')),
        ('apics_wals', lambda ctx, rq: (rq.route_url('walss'), u'WALS\u2013APiCS')),
        ('sentences', partial(menu_item, 'sentences')),
        ('sources', partial(menu_item, 'sources')),
        ('contributors', partial(menu_item, 'contributors')),
    )

    config.register_download(CsvDump(
        common.Language, 'apics', description="Languages as CSV"))
    config.register_download(N3Dump(
        common.Language, 'apics', description="Languages as RDF"))
    config.register_download(Download(
        common.Source, 'apics', ext='bib', description="Sources as BibTeX"))
    config.register_download(Sqlite(
        common.Dataset, 'apics', description="APiCS database as sqlite3"))

    config.register_resource('wals', Wals, IWals, with_index=True)

    config.add_route('chapters', '/admin/chapters')
    config.add_route('chapter', '/admin/chapters/{id}')
    config.add_route('surveys', '/admin/surveys')
    config.add_route('survey', '/admin/surveys/{id}')
    return config.make_wsgi_app()
开发者ID:AnnaLuisaD,项目名称:apics,代码行数:38,代码来源:__init__.py

示例11: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import register_resource [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    settings['route_patterns'] = {
        'villages': '/geography.cfm',
        'parameters': '/thesaurus.cfm',
        'sources': '/bibliography.cfm',
        'languages': '/languages.cfm',
        'florafauna': '/florafauna.cfm',
        'bangime': '/bangime.cfm',
        'file': '/_files/{id:[^/\.]+}',
        'file_alt': '/_files/{id:[^/\.]+}.{ext}',
    }
    config = Configurator(settings=settings)
    config.include('clldmpg')
    config.register_menu(
        ('dataset', partial(menu_item, 'dataset', label='Home')),
        ('languages', partial(menu_item, 'languages')),
        ('values', partial(menu_item, 'values', label='Lexicon')),
        ('parameters', partial(menu_item, 'parameters', label='Thesaurus')),
        ('villages', partial(menu_item, 'villages', label='Villages')),
        ('florafauna', partial(menu_item, 'florafauna', label='Flora-Fauna')),
        #('contributors', partial(menu_item, 'contributors', label='Project members')),
        ('sources', partial(menu_item, 'sources', label='Materials')),
        #('bangime', partial(menu_item, 'bangime', label='Bangime')),
        #('other', partial(menu_item, 'other', label='Other Languages')),
        ('movies', partial(menu_item, 'movies', label='Videos')),
    )
    home_comp = config.registry.settings['home_comp']
    home_comp = [
        'bangime', 'other',
        'contributors'] + home_comp
    config.add_settings({'home_comp': home_comp})
    config.register_resource('village', models.Village, IVillage, with_index=True)
    config.register_resource('movie', models.Movie, IMovie, with_index=True)
    config.register_resource('file', models.File, IFile, with_index=True)
    config.registry.registerUtility(CustomFactoryQuery(), ICtxFactoryQuery)
    config.add_page('bangime')
    config.add_page('florafauna')
    config.add_page('other')
    config.add_page('typology')

    return config.make_wsgi_app()
开发者ID:clld,项目名称:dogonlanguages,代码行数:45,代码来源:__init__.py

示例12: Configurator

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import register_resource [as 别名]
if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG)
    config = Configurator()
    settings = {
        'sqlalchemy.url': 'sqlite://'
    }

    engine = engine_from_config(settings, prefix='sqlalchemy.')
    maker = scoped_session(sessionmaker(
        extension=ZopeTransactionExtension()
    ))
    maker.configure(bind=engine)
    db.register_maker(maker=maker)
    Base.metadata.bind = engine
    Base.metadata.create_all(engine)

    # create two blank models
    session = db.get_session()
    for i in range(10000):
        SuperModel.manager.create()
    db.commit()

    config.include('seth')
    config.register_query_listener(engine, 0)
    config.register_resource(SampleResource, '/test/')

    app = config.make_wsgi_app()
    server = make_server('0.0.0.0', 6543, app)
    server.serve_forever()
开发者ID:turkus,项目名称:seth,代码行数:31,代码来源:listener.py

示例13: Configurator

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import register_resource [as 别名]
if __name__ == '__main__':
    config = Configurator()
    # predefine in memory sqlalchemy database
    settings = {
        'sqlalchemy.url': 'sqlite://'
    }

    engine = engine_from_config(settings, prefix='sqlalchemy.')
    maker = scoped_session(sessionmaker(
        extension=ZopeTransactionExtension()
    ))
    maker.configure(bind=engine)
    # register maker for seth db
    db.register_maker(maker=maker)
    Base.metadata.bind = engine
    Base.metadata.create_all(engine)

    # create two blank models
    session = db.get_session()
    session.add(SuperModel(**{'string_column': 'a'}))
    session.add(SuperModel(**{'string_column': 'b'}))
    db.commit()

    # add seth and register resources
    config.include('seth')
    config.register_resource(SampleApiView, '/test/')
    config.register_resource(SampleModelApiView, '/test_pager/')
    config.register_resource(SampleModelNoPaginateApiView, '/test_no_pager/')
    app = config.make_wsgi_app()
    server = make_server('0.0.0.0', 6543, app)
    server.serve_forever()
开发者ID:turkus,项目名称:seth,代码行数:33,代码来源:api.py

示例14: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import register_resource [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    settings.update(CFG)
    settings['navbar.inverse'] = True
    settings['route_patterns'] = {
        'languages': '/glottolog/language',
        'language': '/resource/languoid/id/{id:[^/\.]+}',
        'source': '/resource/reference/id/{id:[^/\.]+}',
        'sources': '/langdoc',
        #'provider': '/langdoc/langdocinformation#provider-{id}',
        'providers': '/langdoc/langdocinformation',
    }
    settings['sitemaps'] = ['language', 'source']
    config = Configurator(settings=settings)
    #
    # Note: The following routes must be registered before including the clld web app,
    # because they are special cases of a more general route pattern registered there.
    #
    config.add_route('languoid.xhtml', '/resource/languoid/id/{id:[^/\.]+}.xhtml')
    config.add_route('reference.xhtml', '/resource/reference/id/{id:[^/\.]+}.xhtml')

    config.include('clldmpg')
    config.registry.registerUtility(GLCtxFactoryQuery(), ICtxFactoryQuery)
    config.register_menu(
        #('dataset', partial(menu_item, 'dataset', label='Home')),
        ('languages', partial(menu_item, 'languages', label='Languages')),
        ('families', partial(menu_item, 'glottolog.families', label='Families')),
        ('search', partial(menu_item, 'glottolog.languages', label='Language Search')),
        ('sources', partial(menu_item, 'sources', label='References')),
        ('query', partial(menu_item, 'langdoc.complexquery', label='Reference Search')),
        ('about', partial(menu_item, 'about', label='About')),
    )
    config.register_resource('provider', models.Provider, IProvider, with_index=True)
    config.register_adapter(
        adapter_factory('provider/index_html.mako', base=Index), IProvider)
    config.add_view(views.redirect_languoid_xhtml, route_name='languoid.xhtml')
    config.add_view(views.redirect_reference_xhtml, route_name='reference.xhtml')
    config.add_route_and_view('news', '/news', views.news, renderer='news.mako')
    config.add_route_and_view(
        'glottolog.meta',
        '/glottolog/glottologinformation',
        views.glottologmeta,
        renderer='glottologmeta.mako')
    config.add_route_and_view(
        'glottolog.families',
        '/glottolog/family',
        views.families,
        renderer='families.mako')
    config.add_route_and_view(
        'glottolog.iso',
        '/resource/languoid/iso/{id:[^/\.]+}',
        views.iso)
    config.add_route_and_view(
        'glottolog.languages',
        '/glottolog',
        views.languages,
        renderer='language/search_html.mako')
    config.add_route_and_view(
        'glottolog.childnodes',
        '/db/getchildlects',
        views.childnodes,
        renderer='json')
    config.add_route_and_view(
        'langdoc.complexquery',
        '/langdoc/complexquery',
        views.langdoccomplexquery,
        renderer='langdoccomplexquery.mako')

    for name in 'credits glossary cite downloads contact'.split():
        pp = '/' if name == 'credits' else '/meta/'
        config.add_route_and_view(
            'home.' + name,
            pp + name,
            getattr(views, name),
            renderer=name + '.mako')

    config.register_download(adapters.LanguoidCsvDump(
        models.Languoid, 'glottolog3', description="Languoids as CSV"))
    config.register_download(adapters.LanguoidN3Dump(
        Language, 'glottolog3', description="Languoids as RDF"))
    config.register_download(Download(
        Source, 'glottolog3', ext='bib', description="References as BibTeX"))
    config.register_download(N3Dump(
        Source, 'glottolog3', description="References as RDF"))

    config.add_route('langdocstatus', '/langdoc/status')
    config.add_route('langdocstatus.browser', '/langdoc/status/browser')
    config.add_route(
        'langdocstatus.languages', '/langdoc/status/languages-{ed:[0-9]}-{sdt:[0-9]}')
    config.scan('glottolog3.langdocstatus')
    config.register_datatable('providers', Providers)
    return config.make_wsgi_app()
开发者ID:pombredanne,项目名称:glottolog3,代码行数:95,代码来源:__init__.py

示例15: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import register_resource [as 别名]
def main(global_config, **settings):
    """return a Pyramid WSGI application."""
    settings['route_patterns'] = {
        'languages': '/languoid',
        'language': '/languoid/lect/wals_code_{id:[^/\.]+}',
        'source': '/refdb/record/{id:[^/\.]+}',
        'sources': '/refdb',
        'familys': '/languoid/family',
        'family': '/languoid/family/{id:[^/\.]+}',
        'genus': '/languoid/genus/{id:[^/\.]+}',
        'parameters': '/feature',
        'parameter': '/feature/{id:[^/\.]+}',
        'sentences': '/example',
        'sentence': '/example/{id:[^/\.]+}',
        'contributions': '/chapter',
        'contribution': '/chapter/{id:[^/\.]+}',
        'countrys': '/country',
        'country': '/country/{id:[^/\.]+}',
        'contributors': '/author',
        'contributor': '/author/{id:[^/\.]+}',
        'legal': '/about/legal',
        'olac': '/languoid/oai',
        'credits': '/about/credits',
    }
    filename_pattern = re.compile('(?P<spec>(c|d|s|f|t)[0-9a-f]{3})\.png')
    icons = []
    for name in sorted(
        path(__file__).dirname().joinpath('static', 'icons').files()
    ):
        m = filename_pattern.match(name.splitall()[-1])
        if m:
            icons.append(WalsIcon(m.group('spec')))

    config = Configurator(**dict(settings=settings))
    config.include('clldmpg')
    for utility, interface in [
        (WalsCtxFactoryQuery(), ICtxFactoryQuery),
        (map_marker, IMapMarker),
        (Blog(settings), IBlog),
        (icons, IIconList),
    ]:
        config.registry.registerUtility(utility, interface)

    config.register_resource('family', Family, IFamily, with_index=True)
    config.register_resource('genus', Genus, IGenus, with_index=True)
    config.register_resource('country', Country, ICountry)

    config.add_route(
        'sample_alt', '/languoid/samples/{count}.{ext}', factory=sample_factory)
    config.add_route(
        'sample', '/languoid/samples/{count}', factory=sample_factory)

    for spec in [
        dict(
            template='parameter/detail_tab.mako',
            mimetype='application/vnd.clld.tab',
            send_mimetype="text/plain",
            extension='tab',
            name='tab-separated values'),
        dict(
            template='parameter/detail_xml.mako',
            mimetype='application/vnd.clld.xml',
            send_mimetype="application/xml",
            extension='xml',
            name='WALS XML',
            __doc__="Custom XML format."),
        dict(
            template='parameter/detail_georss.mako',
            mimetype='application/vnd.clld.georss+xml',
            send_mimetype="application/rdf+xml",
            extension='georss',
            name="GeoRSS",
            __doc__="RSS with location information "
                    "(http://en.wikipedia.org/wiki/GeoRSS)."),
        dict(
            template='parameter/detail_kml.mako',
            mimetype='application/vnd.google-earth.kml+xml',
            send_mimetype="application/xml",
            extension='kml',
            name='KML',
            __doc__="Keyhole Markup Language"),
    ]:
        config.register_adapter(spec, IParameter)

    config.add_route('feature_info', '/feature-info/{id}')
    config.add_route('genealogy', '/languoid/genealogy')

    config.add_301(
        '/index',
        lambda req: req.route_url('dataset'))
    config.add_301(
        '/.{ext}',
        lambda req: req.route_url('dataset_alt', ext=req.matchdict['ext']))
    config.add_301(
        '/example/{fid}/all',
        lambda req: req.route_url('parameter', id=req.matchdict['fid']))
    config.add_301(
        '/example/all/wals_code_{lid}',
        lambda req: req.route_url(
            'sentences', _query=dict(language=req.matchdict['lid'])))
#.........这里部分代码省略.........
开发者ID:Castroyesid,项目名称:wals3,代码行数:103,代码来源:__init__.py


注:本文中的pyramid.config.Configurator.register_resource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。