Django

Code

Ticket #546 (closed: fixed)

Opened 3 years ago

Last modified 1 year ago

[patch] make render_to_string and render_to_response use select_template

Reported by: hugo <gb@bofh.ms> Assigned to: cmcavoy
Milestone: Component: Template system
Version: Keywords:
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

The attached patch looks for a ";" in the template_name. If there is one, it will split the template_name on ";" and use the resulting list with select_template instead of passing on the template_name to get_template. That way the shortened rendering syntax can be used with template-selection, too.

Attachments

template_loader.diff (2.0 kB) - added by hugo <gb@bofh.ms> on 09/23/05 05:21:48.
patch to render_to_string to make use of select_template
template_loader.2.diff (2.0 kB) - added by hugo <gb@bofh.ms> on 09/23/05 14:08:26.
version of the patch that switches on (list/tuple) or string and uses select_template or get_template

Change History

09/23/05 05:21:48 changed by hugo <gb@bofh.ms>

  • attachment template_loader.diff added.

patch to render_to_string to make use of select_template

09/23/05 08:27:22 changed by adrian

I'd like this a lot better if you could pass a list instead of a string with semicolons in it. The latter seems hacky and unintuitive. What do you think?

09/23/05 14:04:03 changed by anonymous

Sure, would be fine by me - I just thought the

if type(template_name) in (list, tuple):
    select_template(...)
else:
    get_template(...)

would seem hacky ;-)

09/23/05 14:08:26 changed by hugo <gb@bofh.ms>

  • attachment template_loader.2.diff added.

version of the patch that switches on (list/tuple) or string and uses select_template or get_template

07/19/07 08:41:57 changed by mir@noris.de

  • component changed from Admin interface to Template system.
  • stage changed from Unreviewed to Design decision needed.

Looks strange to me, and it seems it wasn't really needed, but I'm just passing this on for decision.

09/14/07 10:56:05 changed by jacob

  • stage changed from Design decision needed to Accepted.

09/14/07 10:57:43 changed by cmcavoy

  • owner changed from nobody to cmcavoy.
  • status changed from new to assigned.

Taking a sprinting stab at it.

09/14/07 11:05:33 changed by cmcavoy

  • status changed from assigned to closed.
  • resolution set to fixed.

Already in trunk.


Add/Change #546 ([patch] make render_to_string and render_to_response use select_template)




Change Properties
Action