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

Fixed #29664 --Caught TypeError exception and giving out meaning full… #10294

Closed
wants to merge 1 commit into from

Conversation

emiamar
Copy link

@emiamar emiamar commented Aug 13, 2018

Fixed #29664 --Caught TypeError exception and giving out meaning full error message

… error message

 Please enter the commit message for your changes. Lines starting
Copy link
Contributor

@jeffyancey jeffyancey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this change needs to occur at all, but can appreciate the frustration of chasing down a bug like this. If we want to go through with providing an error message like this, we need a finer-grained means of determining that the missing .as_view() is what is causing the TypeError.

response = wrapped_callback(request, *callback_args, **callback_kwargs)
response = wrapped_callback(
request, *callback_args, **callback_kwargs)
except TypeError:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if something else throws this TypeError? If we want to give a message like this at all, I think we need to find a better way of ensuring the case you mentioned is causing it.

@emiamar
Copy link
Author

emiamar commented Aug 13, 2018

I agree. This error is actually caused because view class itself is instantiated , when one forgets to call the as_view method. Since view class inherits base class View its __init__ method takes only 2 args.

@charettes
Copy link
Member

I think the best way to detect this would be in View.__new__ or __init__.

@carltongibson
Copy link
Member

I've marked this wontfix on Trac. https://code.djangoproject.com/ticket/29664

If anyone thinks there's a reasonable approach to take please re-open.

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

Successfully merging this pull request may close these issues.

4 participants