﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
4760	BuiltinLibrary class for automatic and easy insertion of custom filters/tags	A. J. Ellerton <aj@…>	nobody	"All,

Re the article here:

[http://groups.google.com/group/django-users/browse_frm/thread/2f254591d5d84340/5ad372019ee0c3c6?lnk=gst&q=custom+filters&rnum=1#5ad372019ee0c3c6 
]
(ignoring the digression about email subject lines!)

I put forward the need for a simple way to have filters and tags that I define in my local script automatically available to DJango, without the need for a package import, or a specific 'template' package within my source tree.

I have attached a page of 4 lines (+ documentation) that enables this with the class BuiltinLibrary. Using the class is as follows:


{{{
 def filter_rst_h1(value, arg='-'):
    ""Write a single underline under the text""
    line=arg * len(value)
    return ""%s\n%s"" % (value, line)

  from django.template import ``BuiltinLibrary`` # <-- NEW!

  # set up extra library of routines for later use...
  library = BuiltinLibrary()
  library.filter('filter_rst_h1', filter_rst_h1) 
}}}

The patch and a full, standalone demonstration program is attached.

Thanks for considering this patch...
A.J.E.



"		closed	Template system	dev		invalid	Builtin Automatic Library		Unreviewed	1	0	0	0	0	0
