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

[WIP] Add view_decorators list to View #5637

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
3 participants
@funkybob
Contributor

funkybob commented Nov 12, 2015

Add an option to the View class to apply decorators to the view function returned by as_view.

[needs docs + tests]

@timgraham

This comment has been minimized.

Show comment
Hide comment
@timgraham

timgraham Nov 12, 2015

Member

I didn't check if this API was ever proposed, but I guess 186eb21 allows the use case with some different syntax?

Member

timgraham commented Nov 12, 2015

I didn't check if this API was ever proposed, but I guess 186eb21 allows the use case with some different syntax?

@funkybob

This comment has been minimized.

Show comment
Hide comment
@funkybob

funkybob Nov 12, 2015

Contributor

I find using method_decorator clumsy for the general case [of decorating all requests] as:

  • it requires importing method_decorator
  • it requires writing a dispatch just to decorate

In comparison, this will decorate the view function itself [avoiding all the hacks to look inside or carry attributes out], supports multiples trivially, is inheritable/extendable...

I'm ok with it being dismissed... just wanted to get this written down and proposed so I could point people at it for comment.

Contributor

funkybob commented Nov 12, 2015

I find using method_decorator clumsy for the general case [of decorating all requests] as:

  • it requires importing method_decorator
  • it requires writing a dispatch just to decorate

In comparison, this will decorate the view function itself [avoiding all the hacks to look inside or carry attributes out], supports multiples trivially, is inheritable/extendable...

I'm ok with it being dismissed... just wanted to get this written down and proposed so I could point people at it for comment.

@timgraham

This comment has been minimized.

Show comment
Hide comment
@timgraham

timgraham Nov 13, 2015

Member

I would raise it on the mailing list for further discussion.

Member

timgraham commented Nov 13, 2015

I would raise it on the mailing list for further discussion.

@auvipy

This comment has been minimized.

Show comment
Hide comment
@auvipy

auvipy Nov 19, 2015

Contributor

view decorators would be a good thing

Contributor

auvipy commented Nov 19, 2015

view decorators would be a good thing

@timgraham

This comment has been minimized.

Show comment
Hide comment
@timgraham

timgraham Dec 21, 2015

Member

Curtis, could you raise it on the mailing list?

Member

timgraham commented Dec 21, 2015

Curtis, could you raise it on the mailing list?

@timgraham

This comment has been minimized.

Show comment
Hide comment
@timgraham

timgraham Feb 22, 2016

Member

Closing due to inactivity. django-developers discussion

Member

timgraham commented Feb 22, 2016

Closing due to inactivity. django-developers discussion

@timgraham timgraham closed this Feb 22, 2016

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