Skip to content

Relax attribute lookup in warning about old-styled middleware #2340

Closed
@asvetlov

Description

For class-based middleware like

class Middleware:
    async def __call__(self, app, handler):
          ...

there is no __name__ attr.
Moreover I could imaging other situations where __name__ doesn't exists.
It breaks web server starting.

Let's change middleware.__name__ to repr(middleware).

Bugfix should be done in 2.3 branch.

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