Does anyone have an example how to hook up external python debugger to indico process?
At this time I’d like to use vscode to step trough some steps to speed up coding.
Payment-plugin:
The other problem that I have is that I semi-dynamic date for event-settings form.
For this example in plugin settings I have json filepath field e.g. value ‘/runtime/data.json’
and vat_key, project_key
example json:
{“{vat_key_value}”: [{“vat_1”:25.5},{“vat_2”:13.5}],”{project_key_value}”: [{“projectid”:”2445”,”data”:”foo”,”name”:bar”}]}
I need to use this data processed when payment event_settings form is created, validated and processed.
Adding these choices to custom field+widget at form init after super().init is too late.
How and where would you store and access this data? The content is refreshed multiple times a day.
I have a way to do this, but it’s hackis to the point that I don’t want to share it.
I basically need a new idea or direction or best practices way of doing this.
The same information is used when creating transaction and verifying transaction states.
Cheers,
TT
Assuming you want to do this in development it’s fairly easy. I have this in my vscode launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Indico dev server",
"type": "debugpy",
"request": "launch",
"program": "/home/adrian/dev/indico/py3/env-312/bin/indico",
"args": [
"run",
"-h", "127.0.0.1",
"-p", "55308",
"-u", "https://indico3.mydevhost",
"--proxy", "-q",
"--reloader", "none"
],
"console": "integratedTerminal",
"justMyCode": false
}
]
}
Needs to be adapted to your own dev environment but I think it’s pretty straightforward what to change.
I have a way to do this, but it’s hackis to the point that I don’t want to share it.
Sorry, but it is MUCH easier to help you if you publish your code somewhere, even if it’s hacky (just note this in your README so people don’t use it). So for the sake of my own time and avoiding wild guesses, please do publish the code if you have questions about it.
Tip: There is existing logic for extending a WTForm. Check the add_form_fields signal. To see some example usage you can search for it in the indico/indico-plugins-cern repo.
1 Like
Thank you, the vscode launch.json was a big help. type: debugpy was the thing apparently I was missing…
I will make code examples available as soon as I have time. This is alread a lot of help.
Problem is I’m getting circular load problem, but I can deal with the hardcoded filepaths for now.
do you mean circular import? If yes, move some of the imports inside the functions where you need the imported object instead of on the top level
Yes, circural import problem. Already tried on of those, but the module was not ready as it’s part of the form.
I’ll get back on this as soon as I have the most pressing matters solved as I can use hardcoded defaults and the settings would be nice to have but are not critical.