On Tuesday, April 3, 2012 8:10:35 PM UTC-4, Zak wrote:
>
> Instead of using something like config.add_route('Index', '/') in my main,
> I want to add a route as a decorator which will be positioned next to the
> relevant view. Something like
>
> @view_addRoute(route'="/index")
> @view_config(route_name='Index', renderer='MyApp:html/compiled/index.mako')
> class Index(SimpleObject):
> def __call__(self):
>
> return {'project':'MyApp'}
>
>
> How can I do this?
>
Have you seen Pyramid Handlers (
http://docs.pylonsproject.org/projects/pyramid_handlers/en/latest/ )?
It might be more to your liking, it allows you to define your handler
classes and then on the methods you have an action decorator. It picks up
the method name to be used as the {action} variable in your route. You
could probably even do some kind of discovery to automatically make every
class in a package into a generic handler.
--
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/-/kfBFISsSpDYJ.
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.