Skip to content

Pylons/pyramid_metatg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TurboGears-like object dispatch for Pyramid
===========================================

This package provides an example of how someone might create TurboGears-like
object dispatch for Pyramid.

TurboGears uses a model whereby a tree of "controllers" is traversed and
subsequently one of the methods of the "final" traversed controller is called
to return a response.  This differs from default Pyramid behavior inasmuch as
the objects traversed by the default Pyramid traverser ("resources") are not
assumed to have response-generating logic as methods.

Under the default Pyramid traversal regime, after a "context" resource is
found via traversal, its job is done.  A separate subsystem ("view lookup")
takes over after the context resource has been found.  View lookup is handed
the context object; its responsibility is to find a view callable by
introspecting the type of the context resource and matching it against a
separate registry of view functions / methods / instances.  It then invokes
the view callable, which returns a response.

TurboGears conflates the traversal and view lookup steps as "object
dispatch".  Thus, in order to emulate TG-style object dispatch, the Pyramid
traverser is replaced with one that returns a controller and a default view
is registered against all Controller objects; this default view finds the
"right" method of the returned controller to use to generate a response and
calls it.

This package provides an alternate traverser, a view implementation that is
used for all Controller objects resulting from traversal , and a paster
template that allows you to try out the result from end-to-end.

Trying it out
-------------

1.  ``python setup.py install``

2.  ``paster create -t pyramid_metatg myproject``

3.  ``cd myproject``

4.  ``python setup.py develop``

5.  ``paster serve development.ini``

Visit the browser on 6543.

About

TurboGears2-like object dispatch for Pyramid (example)

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages