Code

Opened 9 years ago

Closed 7 years ago

#546 closed defect (fixed)

[patch] make render_to_string and render_to_response use select_template

Reported by: hugo <gb@…> Owned by: cmcavoy
Component: Template system Version:
Severity: normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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 (2)

template_loader.diff (2.0 KB) - added by hugo <gb@…> 9 years ago.
patch to render_to_string to make use of select_template
template_loader.2.diff (2.0 KB) - added by hugo <gb@…> 9 years ago.
version of the patch that switches on (list/tuple) or string and uses select_template or get_template

Download all attachments as: .zip

Change History (8)

Changed 9 years ago by hugo <gb@…>

patch to render_to_string to make use of select_template

comment:1 Changed 9 years ago 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?

comment:2 Changed 9 years ago 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 ;-)

Changed 9 years ago by hugo <gb@…>

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

comment:3 Changed 7 years ago by mir@…

  • Component changed from Admin interface to Template system
  • Triage 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.

comment:4 Changed 7 years ago by jacob

  • Triage Stage changed from Design decision needed to Accepted

comment:5 Changed 7 years ago by cmcavoy

  • Owner changed from nobody to cmcavoy
  • Status changed from new to assigned

Taking a sprinting stab at it.

comment:6 Changed 7 years ago by cmcavoy

  • Resolution set to fixed
  • Status changed from assigned to closed

Already in trunk.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.