I mentioned before, in python is more common to do this kind of if chains using a dictionary. Check handle_ajax in capa_module for an example.