On Tue, 2012-02-28 at 10:03 -0800, Ben Sizer wrote: > On Feb 28, 5:41 pm, Chris McDonough <chr...@plope.com> wrote: > > > > You can't mic view_config with add_view. Instead use view_config with a > > scan: > > > > from wsgiref.simple_server import make_server > > from pyramid.config import Configurator > > from pyramid.view import view_config > > > > @view_config(renderer='json', route_name='create_account') > > def hello_world(request): > > return {'content':'Hello!'} > > > > if __name__ == '__main__': > > config = Configurator() > > > > config.add_route('create_account', '/create') > > config.scan() > > > > app = config.make_wsgi_app() > > server = make_server('0.0.0.0', 8080, app) > > server.serve_forever() > > > > Thanks Chris, that works perfectly. > > It just makes me wonder how you'd use the examples at > http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/renderers.html > because none of them have routes defined in the view_config decorator. > Is there a way to add a route to a view_config-decorated view when the > view doesn't have a route name?
Those view configurations use "traversal", but it's not really relevant. However a view resolves to a URL, you can use a renderer to process return data. You just need to decide how you want to map URLs to views (routes or traversal). - C -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to pylons-devel@googlegroups.com. To unsubscribe from this group, send email to pylons-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en.