Bug 1212 - Python module: assign something useful to the per-query data store 'qdata'
Python module: assign something useful to the per-query data store 'qdata'
Status: NEW
Product: unbound
Classification: Unclassified
Component: server
1.6.0
All All
: P5 enhancement
Assigned To: unbound team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-01-27 19:53 CET by episource
Modified: 2017-03-12 14:59 CET (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description episource 2017-01-27 19:53:54 CET
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.
Comment 1 episource 2017-03-12 14:59:52 CET
Diff url has changed. The diff against current master can be found here:
https://github.com/episource/unbound/compare/master...episource:dev/pythonmod-data/master