tags:

views:

39

answers:

1

in pylons, is it possible to loop through all the controllers and their actions?

I want to create a javascript object that has all the controllers and their actions

A: 

I'm writing this under the assumption that you're trying to do a "table of contents" thing. If this is not the case and the below information is not helpful, my apologies.

If you know the controllers you want the actions for before-hand (that is to say, before runtime), you could write

def contents(self):
    return [action for action in dir(self) if all(
        not action in ['contents','start_response'],
        not action.startswith('_'),
        callable(action))]

for each controller and then have another controller (ContentsController, say) call the .contents() method for each.

yarmiganosca