Opened 19 years ago

Closed 17 years ago

Last modified 17 years ago

#1065 closed enhancement (fixed)

Add a template tag that allows for partial caching of templates

Reported by: deric <deric@…> Owned by: nobody
Component: Template system Version: dev
Severity: normal Keywords: sprintsept14 feature
Cc: jshaffer2112@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Attachments (5)

fragment_caching.py (1.2 KB ) - added by Chris Beaven 18 years ago.
Ian Maurer's template tag
fragment_caching_docs.diff (1.6 KB ) - added by nick.lane.au@… 18 years ago.
Added docs
fragment_caching.diff (5.7 KB ) - added by nick.lane.au@… 17 years ago.
Combined patches and added some tests.
fragment_caching.2.diff (5.5 KB ) - added by nick.lane.au@… 17 years ago.
Renamed template library to 'cache'
cache_tag.diff (4.3 KB ) - added by ZZ 17 years ago.
Improved tag to accept time as variable

Download all attachments as: .zip

Change History (20)

comment:1 by Chris Beaven, 18 years ago

Has patch: set
Needs documentation: set
Triage Stage: UnreviewedAccepted

Moving Ian Maurer's post in the group discussion to this ticket since it's a great patch. Probably needs some documentation and then it's good to go.

Approving due to Adrian's comment in the discussion.

{% load fragment_caching %}
{% cache <exptime> <name> [id args..] %}

For instance...

{% load fragment_caching %}
{% cache 500 sidebar object.id %}
    .. sidebar for object ..
{% endcache %}

by Chris Beaven, 18 years ago

Attachment: fragment_caching.py added

Ian Maurer's template tag

by nick.lane.au@…, 18 years ago

Attachment: fragment_caching_docs.diff added

Added docs

comment:2 by Chris Beaven, 18 years ago

Needs documentation: unset
Needs tests: set

by nick.lane.au@…, 17 years ago

Attachment: fragment_caching.diff added

Combined patches and added some tests.

by nick.lane.au@…, 17 years ago

Attachment: fragment_caching.2.diff added

Renamed template library to 'cache'

comment:3 by nick.lane.au@…, 17 years ago

I figured the name 'fragment_caching' was a bit redundant for the template library since all caching within templates will be fragment caching (but maybe it's just me).

comment:4 by John Shaffer <jshaffer2112@…>, 17 years ago

Cc: jshaffer2112@… added
Needs tests: unset

comment:5 by Fredrik Lundh <fredrik@…>, 17 years ago

Keywords: sprintsept14 added
Triage Stage: AcceptedReady for checkin

comment:6 by Philippe Raoult, 17 years ago

Keywords: feature added

comment:7 by Malcolm Tredinnick, 17 years ago

Version: SVN

comment:8 by Malcolm Tredinnick, 17 years ago

Resolution: fixed
Status: newclosed

(In [6580]) Fixed #1065 -- Added a "cache" template tag. Thanks, Ian Maurer and, particularly, Nick Lane.

comment:9 by anonymous, 17 years ago

Unusable, seem to give Unicode errors as soon as you have to do with real non-ascii characters. Was this thoroughly tested?

comment:10 by Malcolm Tredinnick, 17 years ago

Resolution: fixed
Status: closedreopened
Triage Stage: Ready for checkinAccepted

Can you please give an example of how to make it fail?

comment:11 by anonymous, 17 years ago

Hum... for the moment it seems the problem is magically gone. But I swear nothing worked after adding it and it gave Unicode errors :/

comment:12 by Malcolm Tredinnick, 17 years ago

Resolution: fixed
Status: reopenedclosed

Well, if/when you can repeat the problem, please reopen the ticket (don't just add a comment), with details. A small example, plus details of what cache you are using will be required so that we can repeat the problem.

by ZZ, 17 years ago

Attachment: cache_tag.diff added

Improved tag to accept time as variable

comment:13 by zz <zodizz@…>, 17 years ago

Resolution: fixed
Status: closedreopened

Somehow the idea of having cache time spread all over the place seems a bit cluttering especially if you use the tag more frequently throughout templates. Having the timeout in a single variable is helpful.

The patch allows the timeout to be a template variable and also adds some extra tests.

comment:14 by Chris Beaven, 17 years ago

Resolution: fixed
Status: reopenedclosed

ZZ, this is new functionality, so belongs in a new ticket. Please open a new ticket for this new functionality and attach your patch to that :)

comment:15 by zz <zodizz@…>, 17 years ago

ok Ticket #6201

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