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

Allow controllers to handle request_method #10

Closed
pauleveritt opened this Issue Oct 16, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@pauleveritt
Collaborator

pauleveritt commented Oct 16, 2014

Per @wichert from another ticket comment: "Can't you define a separate resource there? Alternatively it shouldn't be too hard to make the request method for a controller configurable."

Is it ok if I work on pull request for this? Basic idea would be to allow:

@SomeResource.controller(name='reboot', method='GET')

The goal for this is to allow multiple GET views on a single resource.

@wichert wichert closed this in f6c4b56 Oct 24, 2014

@pauleveritt

This comment has been minimized.

Collaborator

pauleveritt commented Oct 27, 2014

Gave it a try with:

@AuthResource.controller(name='login', request_method='POST')

...and got:

File "/Users/paul/projects/moonshot/env34/lib/python3.4/site-packages/rest_toolkit/init.py", line 108, in callback
**self.view_arguments)
TypeError: add_view() got multiple values for keyword argument 'request_method'

That line has:

    config.add_view(view,
            route_name=route_name,
            request_method=self.method,
            context=self.state.resource_class,
            **self.view_arguments)

Here is my code:

https://gist.github.com/pauleveritt/098231b8bd95c97b03a2

--Paul

On Oct 24, 2014, at 4:51 PM, Wichert Akkerman notifications@github.com wrote:

Closed #10 #10 via f6c4b56 f6c4b56.


Reply to this email directly or view it on GitHub #10 (comment).

@wichert

This comment has been minimized.

Owner

wichert commented Oct 27, 2014

There is a discrepancy between the code and the documentation: the documentation uses request_method, but the code uses method. I'll update the code to use request_method to better Pyramid conventions.

wichert added a commit that referenced this issue Oct 27, 2014

@pauleveritt

This comment has been minimized.

Collaborator

pauleveritt commented Oct 28, 2014

That worked, thanks.

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