On 6/9/07, Andrew R <[EMAIL PROTECTED]> wrote:
> I think a better long term solution is something like:
>
>         Template.add_templatetags_file('filename.py')
>

So long as your code is in a location where your code can be imported
by Python, there is another way; there are a couple of undocumented
functions in the template system which handle the loading of tag
libraries. One is 'get_library', which takes the Python path of a
module containing a tag library, and returns it. The other, and
probably more useful for your purposes, is 'add_to_builtins', which
also takes the Python path of a module containing a tag library, and
appends that library to the global default tag set.

So something like

    from django.template import add_to_builtins
    add_to_builtins('path.to.your.library')

would make your custom tags globally available without having to
"trick" the normal loading mechanism into finding them.

-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to