durusmail: quixote-users: Request subclassing
Request subclassing
2005-11-09
2005-11-09
2005-11-10
2005-11-10
2005-11-10
2005-11-10
Matt Patterson (3 parts)
2005-11-11
Matt Patterson (2 parts)
2005-11-11
2005-11-11
Request subclassing
David Binger
2005-11-09
On Nov 9, 2005, at 6:26 AM, Matt Patterson wrote:

> Hey,
>
> I sent a mail about being able to use a subclassed HTTPRequest in
> Quixote late last month, with an attached patch which allowed you
> to pass a request class of your own into Publisher.
>
> Did anyone have any thoughts about this (approach more than patch,
> I suppose). The issues around it (amount of extra complexity needed
> to graft on request context stuff at the moment, for one) are
> becoming more pressing here at work, and I'd appreciate your
> opinions. The original message is here: http://mail.mems-
> exchange.org/durusmail/quixote-users/5265/

The caller of process_request (the driver) can supply
an instance of the subclass of HTTPRequest that the application
requires.

If you would prefer to customize the Publisher instead of
the driver, your application's subclass of Publisher
could do this:

     def process_request(self, request):
         request.__class__ = MyHTTPRequest
        return Publisher.process_request(self, request)

The patch seems to offer two more ways of doing what seems to be
the same thing: either by a keyword argument or by overriding the
create_request() method.  Do we need more options?














reply