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 support for venusian.attach()'s depth argument. #637

Closed
AndreLouisCaron opened this issue Jul 17, 2012 · 2 comments
Closed

Add support for venusian.attach()'s depth argument. #637

AndreLouisCaron opened this issue Jul 17, 2012 · 2 comments

Comments

@AndreLouisCaron
Copy link

If you try to enhance Pyramid features by writing a decorator that applies @view_config() to a function generated by this decorator, Configurator.scan() cannot find this view. For example,

from homemade_rpc_framework import register_rpc_method
@register_rpc_method('label', argument_names=['foo','bar'])
def some_rpc_method(request, arguments):
    return {'some': 'result'}

where homemade_rpc_framework.py contains:

from pyramid.view import view_config
def register_rpc_method(label, argument_names):
    def decorator(f):
        @view_config(route=label, renderer='json')
        def pyramid_view(request):
            arguments = ... # extract from request body using 'argument_names'.
            return f(request, arguments)
        return pyramid_view
    return decorator

See Writing a decorator that returns a Pyramid view in the pylons-discuss Google group for more details.

@AndreLouisCaron
Copy link
Author

Robert Forkel mentioned that he had the same issue in cornice and found a solution. Based on his input, I wrote a similar fix for view_config(). It seems to work, but I'm in the process of cleaning up, adding comments and testing.

@mcdonc mcdonc closed this as completed in a8d71ca Nov 4, 2012
@mcdonc
Copy link
Member

mcdonc commented Nov 4, 2012

Thanks! I reimplemented this because I could not figure out what repository your commit was to. In any case, the _depth argument now supplies the functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants