Add_route as a decorator

66 views
Skip to first unread message

Zak

unread,
Apr 3, 2012, 8:10:35 PM4/3/12
to pylons-...@googlegroups.com
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?

Jason

unread,
Apr 4, 2012, 9:20:04 AM4/4/12
to pylons-...@googlegroups.com

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.


clemensherschel

unread,
Apr 4, 2012, 10:59:59 AM4/4/12
to pylons-...@googlegroups.com
We're going to be in CT Fri thru monday. Do you want to visit?
--
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 pylons-...@googlegroups.com.
To unsubscribe from this group, send email to pylons-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.

Reply all
Reply to author
Forward
0 new messages