Opened 12 years ago

Closed 12 years ago

#16939 closed Bug (fixed)

Inaccurate implementation of {% comment %} presented in custom template tag 'howto' guide

Reported by: Julien Phalip Owned by: nobody
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Two sections (see [1] and [2]) of the custom template tag howto guide illustrate an obsolete implementation (6 years old! -- see r1964) of the built-in {% comment %} tag. Those should be updated either to reflect the new implementation (see in [3]) or to provide a different example.

[1] https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#parsing-until-another-block-tag

[2] https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#parsing-until-another-block-tag-and-saving-contents

[3] source:django/trunk/django/template/defaulttags.py?rev=16908#L480

Attachments (1)

r17141-howto-custom-template-tags-comment.diff (1.6 KB ) - added by Sebastian Goll 12 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 by Sebastian Goll, 12 years ago

Has patch: set

Here is an attempt at updating the documentation. It still keeps the actual {% comment %} example since I think it's still valid, but adds a note highlighting the differences to the actual implementation.

I still like the simplified {% comment %} example because it leads to the more elaborate {% upper %} tag in the following section. First we parse the node list but simply ignore it, later we actually use it and run a transformation on it.

Coming up with a completely new introductory example seems not necessary, and with the note regarding the actual implementation of {% comment %} it should be clear that this is only an example, usually one would still use the standard {% comment %} tag for actually commenting out template code.

(The note has the added effect of introducing parser.skip_past() which I wasn't aware of until now. – Slightly unrelated, the patch also fixes a missing period in the single-sentence documentation of the actual {% comment %} tag.)

comment:2 by Claude Paroz, 12 years ago

Triage Stage: AcceptedReady for checkin
Version: 1.3SVN

comment:3 by Chris Beaven, 12 years ago

Resolution: fixed
Status: newclosed

In [17663]:

Fixed #16939 -- Inaccurate implementation of {% comment %} presented in custom template tag 'howto' guide. Thanks sebastian for the patch.

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