Exemple #1
0
def registry(pyramid_config):
    pyramid_config.add_route('some.named.route', '/some/path')
    pyramid_config.add_route('param.route', '/annotations/{id}')

    add_annotation_link_generator(pyramid_config,
                                  'giraffe',
                                  lambda r, a: 'http://giraffes.com')
    add_annotation_link_generator(pyramid_config,
                                  'elephant',
                                  lambda r, a: 'https://elephant.org')
    add_annotation_link_generator(pyramid_config,
                                  'kiwi',
                                  lambda r, a: 'http://kiwi.net',
                                  hidden=True)
    add_annotation_link_generator(pyramid_config,
                                  'returnsnone',
                                  lambda r, a: None)
    add_annotation_link_generator(pyramid_config,
                                  'namedroute',
                                  lambda r, a: r.route_url('some.named.route'))
    add_annotation_link_generator(pyramid_config,
                                  'paramroute',
                                  lambda r, a: r.route_url('param.route', id=a.id),
                                  hidden=True)

    return pyramid_config.registry
Exemple #2
0
def registry(pyramid_config):
    pyramid_config.add_route("some.named.route", "/some/path")
    pyramid_config.add_route("param.route", "/annotations/{id}")

    add_annotation_link_generator(pyramid_config, "giraffe",
                                  lambda r, a: "http://giraffes.com")
    add_annotation_link_generator(pyramid_config, "elephant",
                                  lambda r, a: "https://elephant.org")
    add_annotation_link_generator(pyramid_config,
                                  "kiwi",
                                  lambda r, a: "http://kiwi.net",
                                  hidden=True)
    add_annotation_link_generator(pyramid_config, "returnsnone",
                                  lambda r, a: None)
    add_annotation_link_generator(pyramid_config, "namedroute",
                                  lambda r, a: r.route_url("some.named.route"))
    add_annotation_link_generator(
        pyramid_config,
        "paramroute",
        lambda r, a: r.route_url("param.route", id=a.id),
        hidden=True,
    )

    return pyramid_config.registry
def registry(pyramid_config):
    pyramid_config.add_route('some.named.route', '/some/path')
    pyramid_config.add_route('param.route', '/annotations/{id}')

    add_annotation_link_generator(pyramid_config, 'giraffe',
                                  lambda r, a: 'http://giraffes.com')
    add_annotation_link_generator(pyramid_config, 'elephant',
                                  lambda r, a: 'https://elephant.org')
    add_annotation_link_generator(pyramid_config,
                                  'kiwi',
                                  lambda r, a: 'http://kiwi.net',
                                  hidden=True)
    add_annotation_link_generator(pyramid_config, 'returnsnone',
                                  lambda r, a: None)
    add_annotation_link_generator(pyramid_config, 'namedroute',
                                  lambda r, a: r.route_url('some.named.route'))
    add_annotation_link_generator(
        pyramid_config,
        'paramroute',
        lambda r, a: r.route_url('param.route', id=a.id),
        hidden=True)

    return pyramid_config.registry