How to set default path for templates?

15 views
Skip to first unread message

Lingfeng Xiong

unread,
May 12, 2012, 10:33:29 AM5/12/12
to pylons-...@googlegroups.com
hi all,
I'm new to Pyramid and trying to build a small application with it. I use the default template engine -- chameleon, and move all my views into a folder with the name of 'views' instead the single file 'views.py' in tutorials. However, I found each time I write a new view, I have to set the same path in @view_config just like:
@view_config(route_name = 'login', renderer = '../templates/login.pt')
Is there any way for me to set the default path for templates? I'd like to use
@view_config(route_name = 'login', renderer = 'login.pt')
to make declaration simpler.
Thanks in advanced.

BTW: And is there anyway to make @view_config use the function name as template file name automatically?

Mike Orr

unread,
May 12, 2012, 8:43:36 PM5/12/12
to pylons-...@googlegroups.com
You'll have to write a decorator that calls view_config. I've wished
it did that too.
> --
> 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/-/e8HY_rsqNGgJ.
> 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.



--
Mike Orr <slugg...@gmail.com>
Reply all
Reply to author
Forward
0 new messages