-
Notifications
You must be signed in to change notification settings - Fork 158
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
AttributeError: 'ProfileSummaryModule' object has no attribute 'start' #28
Comments
I think the broader issue is that the profile module doesn't handle the case where a different middleware object returns a valid HttpRequest. When this happens the middleware objects later in the request chain (which includes DevServerMiddleware, which sits at the end) don't get their process_request() method called. Which means no modules will get their process_init() method called. But all the middleware objects' process_response() methods do get called, so DevServerMiddleware calls all modules' process_response(), and that's where the profile module breaks. The profile module isn't guarding for this case. So one fix would be to make all modules more defensive about having their process_response() called without process_init(). Or, I think someone has suggested having DevServerMiddleware insert itself in the front of the middleware list, instead of at the end. (This may have other consequences.) Or maybe DevServerMiddleware can check in process_response() to see it ever saw the request associated with the response, and if it did not, it protects its modules and doesn't call them in this case. I'm not sure which approach makes the most sense. If it's ok to lose DevServer functionality for the cases where middleware responses are triggered, I guess I'd lean towards the last option. But if you want to be able to profile the middleware responses, prepending DevServerMiddleware may be the best option. |
Running into this too. Makes debugging a total nightmare. |
…ramer#28) This doesn't allow profiling other middleware classes when they do something which returns a direct HttpResponse but it does avoid crashing every time something triggers a redirect.
I got tired of this failing all the time on my django-localeurl-using site: acdha/django-devserver@0e2d1c0 I like the idea of inserting ahead of the middleware list to be able to profile other middleware but that would be a much more invasive change. It seems like long-term it would be better to move state to either the request object or the cache and refactor everything to do a get/getattr with graceful failure handling. |
Bump! It would be great if this got fixed. |
I often get this error: AttributeError: 'ProfileSummaryModule' object has no attribute 'start'. I run with werkzeug on.
Traceback: http://paste.pocoo.org/show/369519/
The weird thing is that if I remove 'devserver.modules.profile.ProfileSummaryModule' from DEVSERVER_MODULES, reload the page and then re-add it and reload the page, it suddenly does work.
The text was updated successfully, but these errors were encountered: