Re: @view_config and URL dispatch

2010-12-12 Thread Jerry
Yes this works -- @view_config(route_name='site1', renderer='templates/site1.pt') but not /with/ the 'name' argument (which gives the same error as that in my previous post) -- @view_config(name='site1_view', route_name='site1', renderer='templates/site1.pt') Maybe the doc could have made i

Re: @view_config and URL dispatch

2010-12-12 Thread Eric Lemoine
On Monday, December 13, 2010, blaflamme wrote: > Yes you can, you must defin to which route name it's related: > @view_config(name='my_view', context=MyModel, permission='read', > route_name='site1') > > http://docs.pylonshq.com/pyramid/dev/api/view.html#pyramid.view.view_config Thanks. Then, I

Re: @view_config and URL dispatch

2010-12-12 Thread blaflamme
You must not define the view in your route, that should work: <__init__.py> config.add_route('site1', '/site1') config.scan() @view_config(route_name='site1', renderer='templates/site1.pt') def site1_view(request): return {'foo': 'bar'} Blaise -- You received this message because you ar

Re: Using beaker cache with pyramid

2010-12-12 Thread Jerry
Thanks for the tip. However, the ultimate goal is to cache the template output (e.g., I choose Genshi for its power at some expense of speed) and I'm sure many people would want to know how to juggle Pyramid/Beaker/XTemplate to make it work. Jerry On Dec 13, 3:45 am, Daniel Holth wrote: > Pyram

Re: @view_config and URL dispatch

2010-12-12 Thread Jerry
Hi, I'm also puzzled by the view_config()+config.scan() behavior. This works -- <__init__.py> config.add_route('site1', '/site1', view='myproject.views.site1_view', view_renderer='templates/site1.pt') while the below combination doesn't -- <__init__.py>

Re: @view_config and URL dispatch

2010-12-12 Thread blaflamme
Yes you can, you must defin to which route name it's related: @view_config(name='my_view', context=MyModel, permission='read', route_name='site1') http://docs.pylonshq.com/pyramid/dev/api/view.html#pyramid.view.view_config Blaise -- You received this message because you are subscribed to

@view_config and URL dispatch

2010-12-12 Thread Eric Lemoine
Hi I've been browsing the Pyramid narrative and API docs, and I have a question: can the view_config decorator be used when using URL Dispatch? From the docs I understand that view_config + scan can be used in place of add_view, but not in place of add_route. Can anyone confirm that? Thanks, --

Re: Using beaker cache with pyramid

2010-12-12 Thread Daniel Holth
Pyramid calls a view with the request if it accepts one positional argument, but the cache decorator hides the function's signature so Pyramid passes the context and the request. If you change your view to def home_view(context, request): pass It will probably do something. However, str(context)