Skip to content

UrlDispatcher.add_routes to return list of resource objects #3866

Closed
@ntai

Description

Long story short

UrlDispatcher.add_routes returns nothing. I'd like to see a list of resources returned.

right now,

    def add_routes(self, routes):
        for route_obj in routes:
            route_obj.register(self)

What I want -

    def add_routes(self, routes):
        return [ route_obj.register(self) for route_obj in routes ]

Not sure route_obj.register returns a resource.

Expected behaviour

resources = router.add_routes(routes)

Actual behaviour

router.add_routes(routes) returns nothing

Steps to reproduce

This is an enhancement request.

Your environment

aiohttp 3.0.1
Python 3.6
Ubuntu 18.04 LTS

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions