Skip to content

Load the content of panels dynamically #447

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

Merged
merged 9 commits into from
Nov 10, 2013
Merged

Load the content of panels dynamically #447

merged 9 commits into from
Nov 10, 2013

Conversation

aaugustin
Copy link
Contributor

This should drastically reduce the overhead of the browser toolbar when
a page has a complex template structure or many SQL queries.

@aaugustin
Copy link
Contributor Author

This pull request causes three test failures. We need a better test strategy.


toolbar_counter = 0
toolbar_maxsize = 10 # keep data for the last 10 requests
toolbar_results = SortedDict()
Copy link
Contributor

Choose a reason for hiding this comment

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

No opinion really but what about collections.deque(maxlen=10)? Then as you add more they automatically fall off the other end. You don't really have to keep count.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I first tried using a deque, but I need a dict-like behavior to look up items in get_saved_toolbar.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see it now. Thanks.

@aaugustin
Copy link
Contributor Author

Tests are now passing.

For a reason that I don't understand, testing with Python 2.7 and Django 1.6 blocks on my computer. Adding debugging makes the failure disappear :(

@aaugustin
Copy link
Contributor Author

I'm going to wait for a better alternative to 668be71 to merge this. Otherwise it's good to go.

I don't think the change in the signature of Panel.__init__ will be a problem in practice. Third-party panels have few reasons to override it.

They made it impossible to preserve panel data after the end of a
request.
This should drastically reduce the overhead of the browser toolbar when
a page has a complex template structure or many SQL queries.

This change is backwards-incompatible for third-party panels because it
changes the signature of __init__.

The JavaScript could probably be improved; I'm outside my comfort zone.
aaugustin added a commit that referenced this pull request Nov 10, 2013
@aaugustin aaugustin merged commit 14245b5 into django-commons:master Nov 10, 2013
@aaugustin aaugustin deleted the load-panels-contents-on-demand branch November 10, 2013 09:45
ryneeverett pushed a commit to ryneeverett/django-debug-toolbar that referenced this pull request Oct 2, 2016
…ents-on-demand

 Load the content of panels dynamically
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants