One thing I like about Django is the template language is safe to let
non-python coders loose with. If you directly allow template authors
to start playing with python package names you are breaking this
separation down. It will also IMHO make apps more fragile when moving
between systems with different python packages available or at least
make tracking down version mismatches more difficult.
So I think django has a very *good* reason to only look in
INSTALLED_APPS/templatetags.
If you really need the functionality just write a small app which
contains a new template tag, say 'import' which works as you want.
Cheers,
--
Phil Davis
On Thu, Jul 10, 2008 at 6:08 PM, Amit Upadhyay <upad...@gmail.com> wrote:
> or even {% load %} name can be preserved as one can first
> look into the old way of loading and if it fails can look for new way.
I've done this in my company's mercurial repo of django. It works
well, and allows us to create template/filter libraries independent of
any application.
Right now, we use it to collect a lot of the django snippets together
into a library.
Regards
Rajeev J Sebastian
(For those dismissing django.template features because of non-
programmer/designer/beginner use-cases: there already are quite a few
possibilities to shoot yourself in the foot, and I'd bet the template
language is turing complete.)
I'm -1 on both of these proposals. They're not really solving problems
that are big issues at the moment (having to do a grep through a couple
of files every now and again is hardly a showstopper and if it really
is, encourage your template designers to use comments to indicate which
tags they are using from which files).
Certainly implement the namespacing idea referred to in the thread that
you referenced, but make it fully backwards compatible so that existing
templates still work. That seems like a solution to a lot of the things
you're talking. Trying to pull Python's whole import infrastructure into
templates seems like overkill, however. Things just aren't going to get
complicated enough to justify it.
Malcolm