sampleapp/sampleapp/__init__.py
author Christophe de Vienne <christophe@unlish.com>
Tue, 15 Jul 2014 17:37:50 +0200
changeset 11487 04252e9ff549
parent 11483 7b7ed56bf2fb
child 11492 b0b8942cdb80
permissions -rw-r--r--
Skip core_handle, add a context manager to handle cubicweb errors The context manager is also used to catch errors in render_view. It handles the 'external' errors raised by cubicweb code. The more internal errors, the one that should occur only in url resolving and cubicweb controllers, are handled directly in CubicWebPyramidHandler. ValidationError is handled by CubicWebPyramidHandler for now, but should probably be handled by cw_to_pyramid Related to #4291173
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11483
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     1
from pyramid.config import Configurator
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     2
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     3
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     4
def main(global_config, **settings):
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     5
    """ This function returns a Pyramid WSGI application.
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     6
    """
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     7
    config = Configurator(settings=settings)
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     8
#    config.add_static_view('static', 'static', cache_max_age=3600)
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     9
#    config.add_route('home', '/')
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    10
#    config.scan()
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    11
    return config.make_wsgi_app()