#27359: Make it possible to specify a default template engine
----------------------------------+------------------------------------
     Reporter:  Artur Barseghyan  |                    Owner:  nobody
         Type:  New feature       |                   Status:  new
    Component:  Template system   |                  Version:  1.8
     Severity:  Normal            |               Resolution:
     Keywords:  template engines  |             Triage Stage:  Accepted
    Has patch:  0                 |      Needs documentation:  0
  Needs tests:  0                 |  Patch needs improvement:  0
Easy pickings:  0                 |                    UI/UX:  0
----------------------------------+------------------------------------
Changes (by Carl Meyer):

 * stage:  Unreviewed => Accepted


Comment:

 Given the current API, we are effectively asking projects like django-cms
 or crispy-forms (any third-party project that wants to load and render a
 Django template using the project's settings) to require their users to
 specify some setting (like `DJANGO_CMS_TEMPLATE_ENGINE`) if the project
 has more than one DjangoTemplate engine configured. This may be OK: it's
 explicit and gives the project fine-grained control per third-party
 project. On the downside, it's unlikely to be the obvious first-choice for
 the author of a third-party project; the obvious first choice is to just
 try instantiating `Template` directly, and even worse, this will probably
 appear to work fine until they think to test (or more likely, one of their
 users reports a bug) with multiple configured DTL engines.

 IMO currently direct instantiation of `Template` is an attractive nuisance
 that appears easy and obvious and only breaks in edge cases, at which
 point the person who hits the problem (the project owner) has no
 reasonable way to fix it (without forking the third-party project).

 I think we must do one of two things. We could a) deprecate and eventually
 remove direct instantiation of `Template` altogether, removing the
 attractive nuisance and requiring everyone to always be explicit from the
 start. Or we could b) add a "default DTL engine" marker, as suggested in
 this ticket, so that when a third-party project does the easy and naive
 thing (directly instantiate `Template`), a project owner with multiple DTL
 engines configured has some recourse to fix it without forking.

 I think (b) may be the more practical solution, and kinder to our user
 base.

--
Ticket URL: <https://code.djangoproject.com/ticket/27359#comment:8>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/073.cd5247b723eb02a83407ddca921abf5c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to