sampleapp/sampleapp/views.py
author Denis Laxalde <denis@laxalde.org>
Wed, 29 Apr 2015 22:46:17 +0200
changeset 11575 97110b4af42f
parent 11483 7b7ed56bf2fb
permissions -rw-r--r--
Handle absence of anonymous user Set cw_session and then cw_cnx request attributes to None in case anonymous connection is not allowed (i.e. no "anon" user in config). Then catch AuthenticationError in CubicWebPyramidHandler and return the 'login' view. Closes #4751862.
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.view import view_config
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
@view_config(route_name='home', renderer='templates/mytemplate.pt')
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     5
def my_view(request):
7b7ed56bf2fb Add a basic sample application
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     6
    return {'project': 'sampleapp'}