calebsmith / django-template-debug

A small collection of template tags for debugging and introspecting templates
BSD 3-Clause "New" or "Revised" License
74 stars 11 forks source link

Django 1.8 Depreciation Warnings #34

Open techdragon opened 8 years ago

techdragon commented 8 years ago
WARNINGS:
?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your default TEMPLATES dict: TEMPLATE_DEBUG.

Fixing it shouldn't be too hard. Just need to either rename the variable, or work out the correct way to move the setting into the TEMPLATE dict.

calebsmith commented 8 years ago

Excellent. Thanks for catching this. The hardest part I can imagine is making it work the current way for Django < 1.8 projects. Should likely just be checking for either place or possibly checking the Django version to make the decision. Will also need to update the docs appropriately

techdragon commented 8 years ago

One option is to just check for the global debug variable and not bother with the separate template debug variable. I know at least one other debugging tool uses that approach.

I'm not 100% sure without checking some code, but I think the check for enabled/disabled, could be as simple as if settings.DEBUG or settings.TEMPLATE_DEBUG.

It that way wont let you run the template debug with 'production mode', but its a very easy step forward. I think a more "proper solution" would use the TEMPLATE dictionary in some way, but I'm yet to see anyone set the equivalent of TEMPLATE_DEBUG using the new TEMPLATE dictionary, so I'm not sure if it will be happy with just adding new random variables to it.

calebsmith commented 8 years ago

Thanks for thinking this through a bit.

Agreed. Originally, I liked checking both because I really want to ensure folks intend to have it on when it is. In other words, this tool is pretty harmless except in the case where someone accidentally has it toggled on in production.

TEMPLATE_DEBUG originally has a bit of a different meaning. When enabled, I believe it shows things like undefined variables and other template errors that can silently fail. It seems appropriate to me to just move to checking only on the DEBUG variable. The DEBUG value captures the intentions well enough for me.

I'll try to get to this soon if I can. If not, a pull request implementing this would be greatly appreciated