Ejemplo n.º 1
0
    controller('/',
               SiteController,
               rules=[
                   rule('/', 'index'),
                   rule('/about', 'about'),
                   rule('/terms', 'terms'),
               ]),
    resource('/users',
             UserResource,
             rules=[],
             subresources=[
                 resource('/roles', RoleResource),
             ]),
    controller('/products', ProductController),
    func('/simple', simple),
    include('tests.bundles.controller.fixtures.other_bp_routes',
            attr='explicit'),
]

implicit_routes = lambda: [
    controller(SiteController),
    resource(UserResource, subresources=[
        resource(RoleResource),
    ]),
    prefix('/products', [
        controller(ProductController),
    ]),
    func(simple),
    include('tests.bundles.controller.fixtures.other_bp_routes',
            attr='implicit'),
]
Ejemplo n.º 2
0
from flask_unchained.bundles.controller import Controller, include, route

routes = lambda: [
    include('tests.bundles.controller.fixtures.vendor_bundle.routes'),
]


class SiteController(Controller):
    @route('/')
    def index(self):
        return 'index rendered'

    def about(self):
        return 'about rendered'


@route(endpoint='views.view_one')
def view_one():
    return 'view_one rendered'


@route('/two', endpoint='views.view_two')
def view_two():
    return 'view_two rendered'


def should_be_ignored():
    raise NotImplementedError