Skip to content

Refs #910: Skip template-based widget templates by default #942

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

Conversation

matthiask
Copy link
Member

No description provided.

@codecov
Copy link

codecov bot commented May 4, 2017

Codecov Report

Merging #942 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #942   +/-   ##
=======================================
  Coverage   83.43%   83.43%           
=======================================
  Files          31       31           
  Lines        1672     1672           
  Branches      249      249           
=======================================
  Hits         1395     1395           
  Misses        200      200           
  Partials       77       77
Impacted Files Coverage Δ
debug_toolbar/settings.py 60% <ø> (ø) ⬆️
debug_toolbar/panels/templates/panel.py 88% <100%> (ø) ⬆️

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 f37d7ee...a0ebcc3. Read the comment docs.

@matthiask matthiask requested a review from aaugustin May 4, 2017 15:50
'SKIP_TEMPLATE_PREFIXES': (
'debug_toolbar/',
'django/forms/widgets/',
'admin/widgets',
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing trailing slash. If it's intentionally omitted, the docs change is wrong instead :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! I meant to include the trailing slash.

@@ -85,7 +85,8 @@ def _store_template_info(self, sender, **kwargs):

# Skip templates that we are generating through the debug toolbar.
if (isinstance(template.name, six.string_types) and
template.name.startswith('debug_toolbar/')):
Copy link
Contributor

Choose a reason for hiding this comment

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

By making this configurable, it becomes possible to unsilence (accidentally by deleting the wrong line in your own SKIP_TEMPLATE_PREFIXES, or intentionally) the djdt templates themselves.
Presumably, it's never been requested to be able to do so (or has been rejected for introducing too much configuration when it wasn't previously potentially necessary) so is it worth keeping the hard-coded extant functionality and making the SKIP_TEMPLATE_PREFIXES an additional set of skips?

Choose a reason for hiding this comment

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

I think I agree with @kezabelle . It's probably going to cause fewer headaches for people if we keep the 'debug_toolbar/' skip hard-coded instead of requiring users who customize the list to include it.

On the other hand, if it makes developing and debugging the toolbar itself easier, I don't think it's a big deal, as long as the default value is clearly documented.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. We can do that later should the need arise. I changed this.

@goblinJoel
Copy link

This looks like a simple, effective fix, if not as fancy as de-duplicating or lazy loading (which would allow users to still see skipped templates and contexts if they needed to).

@matthiask matthiask merged commit bb9bce5 into django-commons:master May 5, 2017
@matthiask matthiask deleted the mk/skip-template-prefixes branch May 5, 2017 07:05
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