Bugzilla – Bug 1212
Python module: assign something useful to the per-query data store 'qdata'
Last modified: 2018-05-02 11:09:25 CEST
The methods `operate` and `inform_super` both have a parameter named `qdata` which is described as "per query data, here you can store your own data".
However, the python module implementation passes `None` as argument value. There's no way for the python code to assign something else to the per-query data store or modify `None`.
Please consider initializing the per-query data store as `dict`. This would allow the python module script to add custom items.
@github I've prepared a possible patch. Please have a look at: https://github.com/episource/unbound/compare/9a7dfb16f205907413db80eb126c98c08620cef8...episource:dev/pythonmod-data/main
The proposed patch also changes the initialization of the `mod_env` global variable from `None` to a `dict` instance. Certainly, `mod_env` could be ommited completly: If needed, a global variable could be created from the python module's code as well. I see no need for storing the data in the python module's internal C data structures.
Diff url has changed. The diff against current master can be found here:
I've created a github pull request for this: https://github.com/NLnetLabs/unbound/pull/4
We are willing to merge your code to unbound's source.
Currently we are releasing 1.7.1, so this code after internal review will be headed for the next release (probably 1.7.2).
Thanks for the contribution!