[Django] #21526: register = template.Library(). Is the instance name just a convention?

0 views
Skip to first unread message

Django

unread,
Nov 28, 2013, 12:54:58 PM11/28/13
to django-...@googlegroups.com
#21526: register = template.Library(). Is the instance name just a convention?
-------------------------------+-----------------------------------------
Reporter: oubiga | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 1.6
Severity: Normal | Keywords: register, template, Library
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+-----------------------------------------
https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#code-
layout shows:

[... To be a valid tag library, the module '''must''' contain a module-
level variable '''named register''' that is a template.Library instance,
in which all the tags and filters are registered. So, near the top of your
module, put the following: ...]

if I'm not mistaken, "register" is just a convention. I would be more
explicit:

[... To be a valid tag library, the module '''must''' contain a module-
level variable '''(by convention named register)''' that is a
template.Library instance, in which all the tags and filters are
registered. So, near the top of your module, put the following: ...]

--
Ticket URL: <https://code.djangoproject.com/ticket/21526>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 28, 2013, 12:59:33 PM11/28/13
to django-...@googlegroups.com
#21526: register = template.Library(). Is the instance name just a convention?
-------------------------------------+-------------------------------------
Reporter: oubiga | Owner: nobody
Type: Uncategorized | Status: closed
Component: Documentation | Version: 1.6
Severity: Normal | Resolution: invalid
Keywords: register, template, | Triage Stage:
Library | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by bmispelon):

* status: new => closed
* needs_better_patch: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_docs: => 0


Comment:

Hi,

The documentation is correct here. Django's template code specifically
looks for a variable named `register`:
https://github.com/django/django/blob/master/django/template/base.py#L1286

--
Ticket URL: <https://code.djangoproject.com/ticket/21526#comment:1>

Django

unread,
Nov 28, 2013, 1:09:57 PM11/28/13
to django-...@googlegroups.com
#21526: register = template.Library(). Is the instance name just a convention?
-------------------------------------+-------------------------------------
Reporter: oubiga | Owner: nobody
Type: Uncategorized | Status: closed
Component: Documentation | Version: 1.6

Severity: Normal | Resolution: invalid
Keywords: register, template, | Triage Stage:
Library | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by oubiga):

Hi,
You are absolutely right!
Thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/21526#comment:2>

Reply all
Reply to author
Forward
0 new messages