Rare uncaught exception when also using django-allauth #292

Closed
sssbox opened this Issue Jun 22, 2012 · 0 comments

Comments

Projects
None yet
1 participant

sssbox commented Jun 22, 2012

This line causes an uncaught exception for a condition that I haven't had time to track down but I'm guessing is related to a fake user account being created by django-allauth.

The hacked solution I came up with was:

  1. Copy debug_toolbar/panels/template.py into my local utils app under utils/debug_panels/
  2. Instead of debug_toolbar.panels.template.TemplateDebugPanel in DEBUG_TOOLBAR_PANELS I used utils.debug_panels.template.TemplateDebugPanel
  3. Add the following lines to the local copy of templates.py after temp_layer[key] = '<<unicode encode error>>':
                        except:
                            temp_layer[key] = '<<Unknown exception>>'

To repeat the exception:

  1. Install django-allauth
  2. Set SOCIALACCOUNT_AUTO_SIGNUP = False, ACCOUNT_EMAIL_VERIFICATION = False, ACCOUNT_EMAIL_REQUIRED = True and ACCOUNT_USERNAME_REQUIRED = False in settings.py
  3. Log in with google so that you reach the /accounts/social/signup/ screen.

Appendix

Stacktrace clippings:

DoesNotExist at /accounts/social/signup/
No exception supplied
Request Method: GET
Request URL:    http://<>/accounts/social/signup/
Django Version: 1.4
Exception Type: DoesNotExist
Exception Location: <~>/.virtualenvs/<>/python2.6/site-packages/django/db/models/fields/related.py in __get__, line 343
Python Version: 2.6.5
...
<~>/.virtualenvs/<>/python2.6/site-packages/debug_toolbar/panels/template.py in _store_template_info
85.                            pformat(value)  # this MAY trigger a db query 
▼ Local vars
    * context_layer     Error in formatting: 
    * temp_layer       {}
    * context_data    [{}, {'csrf_token': <django.utils.functional.__proxy__ object at 0x386ee10>}, {'perms': <django.contrib.auth.context_processors.PermWrapper object at 0x39ba750>, 'user': <django.utils.functional.SimpleLazyObject object at 0x34c6dd0>}, {'debug': True, 'sql_queries': [<>]}, {'LANGUAGES': <>}, {'MEDIA_URL': 'http://<>/user_media/'}, {'STATIC_URL': 'http://<>/site_media/'}, {'request': <WSGIRequest path:/accounts/social/signup/,
        GET:<QueryDict: {}>,
        POST:<QueryDict: {}>,
        COOKIES:{'csrftoken': '<>',
         'djdt': 'hide',
         'sessionid': '6a0ec0e6307ed7523f3ebaa235e72763'},
    META:{<>}, {'messages': <django.contrib.messages.storage.fallback.FallbackStorage object at 0x7f23d0016ad0>}, {'CONTACT_EMAIL': (<>)}, {'socialaccount': {'providers': [<allauth.socialaccount.providers.openid.models.OpenIDProvider object at 0x34bad90>, <allauth.socialaccount.providers.twitter.models.TwitterProvider object at 0x34ba090>, <allauth.socialaccount.providers.facebook.models.FacebookProvider object at 0x34c00d0>]}}, {'is_mobile': False, 'was_mobile': False, 'flavour': u'full'}]
    * self <debug_toolbar.panels.template.TemplateDebugPanel object at 0x37ef350>
    * value Error in formatting: 
    * t     <django.template.base.Template object at 0x39baf10>
    * key   'account'
    * kwargs     {<>}
    * context_list   [<>]
    * sender <django.template.base.Template object at 0x39baf10>

aaugustin closed this in 71921c3 Oct 26, 2013

@ryneeverett ryneeverett pushed a commit to ryneeverett/django-debug-toolbar that referenced this issue Oct 2, 2016

@aaugustin aaugustin Strengthen error handling in templates panel.
Fix #292.
dd4bc74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment