Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add doc about the top level member limitation of view_config #1121

Merged
merged 1 commit into from
Sep 12, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions pyramid/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ def my_view(context, request):
See :ref:`mapping_views_using_a_decorator_section` for details about
using :class:`pyramid.view.view_config`.

ATTENTION: ``view_config`` will work ONLY on module top level members
because of the limitation of ``venusian.Scanner.scan``.

"""
venusian = venusian # for testing injection
def __init__(self, **settings):
Expand Down Expand Up @@ -205,7 +208,7 @@ class view_defaults(view_config):

See :ref:`view_defaults` for more information.
"""

def __call__(self, wrapped):
wrapped.__view_defaults__ = self.__dict__.copy()
return wrapped
Expand Down Expand Up @@ -305,7 +308,7 @@ class notfound_view_config(object):

from pyramid.view import notfound_view_config
from pyramid.response import Response

@notfound_view_config()
def notfound(request):
return Response('Not found, dude!', status='404 Not Found')
Expand Down Expand Up @@ -368,7 +371,7 @@ class forbidden_view_config(object):

from pyramid.view import forbidden_view_config
from pyramid.response import Response

@forbidden_view_config()
def forbidden(request):
return Response('You are not allowed', status='401 Unauthorized')
Expand Down Expand Up @@ -404,4 +407,4 @@ def callback(context, name, ob):

settings['_info'] = info.codeinfo # fbo "action_method"
return wrapped