Hi all,

with its paster command "pviews" Pyramid offers a nice way to check the view 
callables that can be reached by a certain URL. Now, I'd like to go the 
other way round, that is list *all* registered views and display their 
attributes like name, permission etc. So I get not lost in details and code 
;)

After having analysed the pviews command and read more about ZCA than I ever 
wanted to ask (but now that I know about Adapters and Utilities and such, I 
ask myself how I could've lived without it), I came up with a little 
script<http://3amcode.de/pharaoh/static-pym/cms/pharaoh/viewbrowser.py>that:
- collects all registered views
- lists them grouped by their module
- shows detailed info like pviews

Ok, I borrowed much from the pviews command, and some subjects are still 
unclear for me. The questions are in the code.

One question I'd like to ask here is, given a view adapter queried from the 
registry, and also the corresponding view callable, is it possible to 
determine the context that was defined for the view (e.g. as 
@view_config(context="Foo")). With such context and the traversal functions, 
I could also list the URL path that invokes each view.

Some more notes and the code to download you'll find here:
http://3amcode.de/pharaoh/Cms/pharaoh/learning-pyramid/list-registered-views-zope-component-architecture

Maybe someone finds this useful, too.

Thanks,
Dirk

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pylons-discuss/-/OAU9WoJo9cUJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to