Opened 19 years ago

Closed 17 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: no UI/UX: no

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@…> 19 years ago.
patch to render_to_string to make use of select_template
template_loader.2.diff (2.0 KB ) - added by hugo <gb@…> 19 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)

by hugo <gb@…>, 19 years ago

Attachment: template_loader.diff added

patch to render_to_string to make use of select_template

comment:1 by Adrian Holovaty, 19 years ago

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 by anonymous, 19 years ago

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 ;-)

by hugo <gb@…>, 19 years ago

Attachment: template_loader.2.diff added

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

comment:3 by mir@…, 17 years ago

Component: Admin interfaceTemplate system
Triage Stage: UnreviewedDesign 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 by Jacob, 17 years ago

Triage Stage: Design decision neededAccepted

comment:5 by cmcavoy, 17 years ago

Owner: changed from nobody to cmcavoy
Status: newassigned

Taking a sprinting stab at it.

comment:6 by cmcavoy, 17 years ago

Resolution: fixed
Status: assignedclosed

Already in trunk.

Note: See TracTickets for help on using tickets.
Back to Top