James Bennett wrote:
> 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. 
> [snip]
> So something like
> 
>     from django.template import add_to_builtins
>     add_to_builtins('path.to.your.library')

Good tip - thanks!

I have to admit, though, that I think adding a custom filter should be as simple
as this code alone:

> from django.template import Library
>
> register = Library()
>
> @register.filter
> def javadoc_filter(value, arg):
>    return "whatever"

I think part of my confusion was that my subconscious thinking was "my filter
code has been imported (I can see the .pyc) so I know python has seen it, and
therefore the filter is registered with the library, so I should be able to use
it.".

This thinking does not reflect the current reality, and thats ok because I have
a workaround. But I think there is merit in a plain approach like that.

After all - Django is into the D.R.Y. principle, so having to use
register.filter() *as well* as have to have the module in a certain directory,
seems a bit repetitious.

JFWIW
Andrew


--~--~---------~--~----~------------~-------~--~----~
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