Find_backlink_handles class name references

I see that find_backlink_handles returns a class name. Most uses appear to compare this against a string. Is there a location of constants or class objects that this can be compared with to avoid issues with typos in strings?

You could use the CLASS_TO_KEY_MAP dictionary in the dbconst.py file. I don’t think that there is a recommended or consistent way to do this though. The same applies to looping through all object types. I seem to remember seeing a list of object types appear in a few places in the code.

Thanks, that works nicely. I’m coming from a strongly typed programming background and find it’s useful to use constants like that where possible to avoid typos and to aide in refactoring.

Here’s an example of it’s use for others that may want to do this addons-source/TodoReport.py at todo-report-context · jpschewe/addons-source · GitHub

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.