sampleapp/sampleapp/__init__.py
author Christophe de Vienne <christophe@unlish.com>
Sat, 08 Nov 2014 23:07:20 +0100
changeset 11524 54c83bfda277
parent 11492 b0b8942cdb80
permissions -rw-r--r--
Don't rollback if exception is HTTPSuccessful or HTTPRedirection In the request finishing, the 'cleanup' callback set by _cw_cnx automatically commit the transaction except is an exception is set on the request. Problem is, redirections and successul http return code can raise exceptions. This patch detects such exceptions and avoid rolling back the transaction. Closes #4566482
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)
11492
b0b8942cdb80 Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents: 11483
diff changeset
     8
    config.include('pyramid_cubicweb.init_instance')
b0b8942cdb80 Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents: 11483
diff changeset
     9
    config.include('pyramid_cubicweb.defaults')
b0b8942cdb80 Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents: 11483
diff changeset
    10
    config.include('pyramid_cubicweb.core')
b0b8942cdb80 Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents: 11483
diff changeset
    11
    config.include('pyramid_cubicweb.bwcompat')
11483
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    12
#    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
    13
#    config.add_route('home', '/')
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    14
#    config.scan()
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    15
    return config.make_wsgi_app()