Roundup Tracker - Issues

Message7073

Author rouilj
Recipients cmeerw, rouilj, schlatterbeck, tttech-klonner
Date 2021-02-09.21:35:52
Message-id <20210209213551.7713D4C02D3@itserver6.cs.umb.edu>
In-reply-to <1612904631.59.0.383569670816.issue2551112@roundup.psfhosted.org>
Hi Christof:

In message <1612904631.59.0.383569670816.issue2551112@roundup.psfhosted.org>,
Christof Meerwald writes:
>In your wsgi wrapper you can do something like:
>
>from roundup.cgi.wsgi_handler import RequestDispatcher
>
>class MyRequestDispatcher(RequestDispatcher):
>    def __init__(self, home):
>        RequestDispatcher.__init__(self, home)
>
>    @contextmanager
>    def get_tracker(self):
>        tracker = ...
>        yield tracker
>
>tracker_home = '/path/to/tracker/home'
>app = MyRequestDispatcher(tracker_home)

Ok, that makes sense. Does the change to __init__ to call
get_tracker() break this in some way? I am still trying to get my head
around your concern.

> ... allow additional customisation (e.g. inherit from
> RequestDispatcher and override=20 get_tracker or add additional
> initialisation in the derived class). This hardcoded call from
> __init__ makes it a lot harder to customise the behaviour
> (because your overriding get_tracker relies on additional=20
> initialization from your __init__).

It seems that this still allows for customization.

Note that in the __init__ call the result from get_tracker is
discarded, so it is basically a noop as I understand it.  It is
invoked only for its side effects.

Any customization of get_tracker() would require that the programmer
make sure that any side effects are ok to invoke multiple times. But I
don't consider this to be "a lot harder" but I may be missing
something.
History
Date User Action Args
2021-02-09 21:35:53rouiljsetrecipients: + schlatterbeck, cmeerw, tttech-klonner
2021-02-09 21:35:53rouiljlinkissue2551112 messages
2021-02-09 21:35:52rouiljcreate