I am still studying the pyramid, and I am at the point where I am trying to learn how to use decorators. Below is a copy of my test view.
from pyramid.response import Response from pyramid.view import view_config from pyramid.renderers import render_to_response def my_blog(request): return {'project':'tricky'} @view_config( renderer='templates/foo.pt' ) def foo_blog(request): return {'name':'tricky'}
From what I can understand about the view_config decorator, it can be used to set application configurations without actually installing them in the configuration file. In the case of this example, I set the visualizer as /foo.pt templates. It never works.
However, if I install the renderer in the configuration file ( init .py) as such:
config.add_route( 'foo_blog' , '/blog/{foo}' , view='tricky.views.Blog.blog.foo_blog' renderer='tricky:templates/mytemplate.pt' )
he will work.
I am doing something wrong, which prevents me from using the decorator. Thanks!
source share