Well, we can change decorator_from_middleware to introspect the middleware 
itself and decide accordingly:

-- if it does not have process_request or process_response as callable 
attributes, and it is callable itself, it is a new-style middleware 

-- if it does, we can define a new attribute '_dep5' (or something) whose 
presence will indicate a dep5-compatible middleware. This attribute can be 
defined on the transition mixin, so that people who use it for transition don't 
have to care

-- if it has callable process_request/process_response and doesn't have _dep5 
then it is an old-style middleware

Note that decorator_from_middleware already used to instantiate the middleware 
class anyway, so the check can be applied to a middleware object, not to a 
middleware factory.

The whole introspection behavior, including the _dep5 attribute and the code 
that checks for it, can be dropped when old-style middleware is finally 
dropped. If someone uses _dep5 manually, it will do them no harm later.

What am I missing?

Shai.

Reply via email to