#4760: BuiltinLibrary class for automatic and easy insertion of custom
filters/tags
---------------------------------------------+------------------------------
Reporter: A. J. Ellerton <[EMAIL PROTECTED]> | Owner: adrian
Status: new | Component: Template system
Version: SVN | Keywords: Builtin Automatic
Library
Stage: Unreviewed | Has_patch: 1
---------------------------------------------+------------------------------
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.
--
Ticket URL: <http://code.djangoproject.com/ticket/4760>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---