Skip to content

Conversation

@jackton1
Copy link

@jackton1 jackton1 commented Jan 8, 2018

Traceback (most recent call last):
  File "/Users/user/.virtualenvs/venv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/Users/user/.virtualenvs/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 217, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/Users/user/.virtualenvs/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 215, in _get_response
    response = response.render()
  File "/Users/user/.virtualenvs/venv/lib/python3.6/site-packages/django/template/response.py", line 107, in render
    self.content = self.rendered_content
  File "/Users/user/.virtualenvs/venv/lib/python3.6/site-packages/django/template/response.py", line 84, in rendered_content
    content = template.render(context, self._request)
  File "/Users/user/.virtualenvs/venv/lib/python3.6/site-packages/django/template/backends/django.py", line 66, in render
    return self.template.render(context)
  File "/Users/user/.virtualenvs/venv/lib/python3.6/site-packages/django/template/base.py", line 207, in render
    return self._render(context)
  File "/Users/user/.virtualenvs/venv/lib/python3.6/site-packages/django/test/utils.py", line 106, in instrumented_test_render
    template_rendered.send(sender=self, template=self, context=context)
  File "/Users/user/.virtualenvs/venv/lib/python3.6/site-packages/django/dispatch/dispatcher.py", line 193, in send
    for receiver in self._live_receivers(sender)
  File "/Users/user/.virtualenvs/venv/lib/python3.6/site-packages/django/dispatch/dispatcher.py", line 193, in <listcomp>
    for receiver in self._live_receivers(sender)
  File "/Users/user/.virtualenvs/venv/lib/python3.6/site-packages/debug_toolbar/panels/templates/panel.py", line 103, in _store_template_info
    pformatted = self.pformat_layers[index]
IndexError: list index out of range

@matthiask
Copy link
Member

matthiask commented Jan 9, 2018

@jackton1 Thank you! When would this happen?

@kezabelle Would be great to have your eyes on this if you find the time. Thanks in advance :)

@codecov
Copy link

codecov bot commented Jan 9, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@e78ac8c). Click here to learn what that means.
The diff coverage is 75%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master   #1024   +/-   ##
========================================
  Coverage          ?   84.1%           
========================================
  Files             ?      24           
  Lines             ?    1296           
  Branches          ?     177           
========================================
  Hits              ?    1090           
  Misses            ?     156           
  Partials          ?      50
Impacted Files Coverage Δ
debug_toolbar/panels/templates/panel.py 85.38% <75%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e78ac8c...3a541f1. Read the comment docs.

@kezabelle
Copy link
Contributor

If I'm re-reading the pseudo-cache stashing correctly, I think for this to have happened, this has to fail: force_text(pformat(temp_layer)) and the context layer has to appear twice?
In which case there's 2 options I think:

  • handling it here makes sense, as it means we can skip looking at the layer again, and it'll silently skip this every time it sees it OR;
  • change so that when UnicodeEncodeError happens, store the layer as <<unicode encode error>> ... though I think it must be a UnicodeEncodeError on the key to avoid hitting that repr-replacement?

@jedie
Copy link

jedie commented Jul 10, 2018

I see this error, too.
It's with:

Django==1.11.14
django-debug-toolbar==1.9.1

It happens only at the first request, after the developing server restarts.

Any work-a-round for this?

@camilonova
Copy link
Contributor

@jackton1 could you please add a test?

@jedie
Copy link

jedie commented Sep 19, 2018

This issues still exists in django-debug-toolbar==1.10.1 :(

@jackton1
Copy link
Author

jackton1 commented Aug 8, 2019

@camilonova been a while I added this change, I'll include the test.

Base automatically changed from master to main February 11, 2021 15:01
@tim-schilling
Copy link
Member

Closing this PR due to inactivity and the lack of a test case to reproduce this. If anyone is still having issues with this, please let me know and we can work towards fixing the issue.

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.

6 participants