view_config to register a url to a view

2012-11-22 Thread Chris Withers
Hi All, I may be imagining this, but in previous versions, was there a way to do: @view_config(blah='/some/url.html') def my_view(request): ... In any case, is there any way I can do that now, without calling add_route separately? I have a bunch of views, which have a one to one mapping

Re: view_config to register a url to a view

2012-11-22 Thread Robert Forkel
AFAIK it was the other way round: you could specify view parameters with add_route. Anyway, when I have lot's of views with one-to-one mappings to routes I tend to use the imperative config method and write a small function which does both config.add_route and config.add_view in one go. regards

Re: view_config to register a url to a view

2012-11-22 Thread Chris Withers
On 22/11/2012 08:18, Robert Forkel wrote: On Thu, Nov 22, 2012 at 9:15 AM, Chris Withersch...@simplistix.co.uk wrote: Hi All, I may be imagining this, but in previous versions, was there a way to do: @view_config(blah='/some/url.html') def my_view(request): ... AFAIK it was the other

Proper pattern for Pyramid, MongoDB and models.py

2012-11-22 Thread Christoph Haas
Dear list, I've been using Pylons for years. Now I want to create a web app in Pyramid using MongoDB. I followed http://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/database/mongodb.html and the approach works well. I can access the MongoDB database using request.db from my

Re: Proper pattern for Pyramid, MongoDB and models.py

2012-11-22 Thread maxfrei
Hello! If you will use mongoengine as orm you just need to register you connection during start application in main() function. After it you can simple work with models without passing connection. http://mongoengine.org/ On Friday, November 23, 2012 3:10:48 AM UTC+3, Christoph Haas wrote:

Re: Proper pattern for Pyramid, MongoDB and models.py

2012-11-22 Thread Malthe Borch
On 23 November 2012 01:10, Christoph Haas em...@christoph-haas.de wrote: ... [snip] so later I could perhaps replace MongoDB by something else but have all the abstraction in the models.py. I think this is missing the point: you're using MongoDB because you need or want some subset of features.