Message7835
Sent this to roundup-devel on the 21st. Tomorrow is a week without any response, remove it.
email start --
Does anybody know how the schema_hook property of a Tracker object is
supposed to be used? Any ideas on what its purpose is?
It is defined in instance.py:Tracker::__init__ with:
# if set, call schema_hook after executing schema.py will get
# same variables (in particular db) as schema.py main purpose is
# for regression tests
self.schema_hook = None
It's invoked with:
if isinstance(self.schema_hook, Callable):
self.schema_hook(**env)
right after schema.py is executed.
A grep in current code under roundup/, test/ and doc/ doesn't show any
examples of it being set.
It was added in changeset: 4211:61cf00ca920a by Ralf. The change was
for mailgw and was used in the test_mailgw.py.
Its use in test_mailgw.py was removed in 4342:94c992852f12 with the
addition of memorydb to speed up testing.
It looks like:
1) the use of schema_hook was for testing not production
2) it has been removed from testing and was just not removed
from instance.py
3) it was never meant to be accessible from schema.py
One possible use case for it is to run some type of validator once the
schema is fully loaded. There is a validator method that can be hooked
into in configuration.py. It runs after the whole config is loaded.
Since schema.py is edited per tracker, this use case is handled by
writing the validation code at the end of schema.py. No need for a
schema_hook.
Does anybody think there is a real use case for keeping schema_hook?
email end --- |
|
Date |
User |
Action |
Args |
2023-09-27 21:49:45 | rouilj | set | recipients:
+ rouilj |
2023-09-27 21:49:45 | rouilj | set | messageid: <1695851385.93.0.110157003843.issue2551293@roundup.psfhosted.org> |
2023-09-27 21:49:45 | rouilj | link | issue2551293 messages |
2023-09-27 21:49:45 | rouilj | create | |
|