On 10/08/2014 10:06 AM, tonthon wrote:
> Hi,

> A module's includeme function is called when the module is included
> using config.include:
> 
> See
> http://docs.pylonsproject.org/docs/pyramid/en/latest/api/config.html#module-pyramid.config
> to learn more about the config.include method.

The nearest thing I was able to write is something like:

## main.py ##
...

import views

if __name__ == '__main__':
  config = Configurator()
  config.scan()
  config.include(views)

...

## views.py ##
def includeme(config):
  config.add_route(...)
  def a_view(request):
    pass
  config.add_view(...)
        
It's a bit awkward to define the views inside includeme() but it works,
I was expecting some scope issue.

The problem is once you wrap the views in a class I still haven't been
able to think a way to place the routes really near to the views
definitions.

Still at least I can keep routes and views in the same file.

thanks

-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to