Message7073
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. |
|
Date |
User |
Action |
Args |
2021-02-09 21:35:53 | rouilj | set | recipients:
+ schlatterbeck, cmeerw, tttech-klonner |
2021-02-09 21:35:53 | rouilj | link | issue2551112 messages |
2021-02-09 21:35:52 | rouilj | create | |
|