David Bernard wrote:
I prefer 2 and 4. I don't enjoy 3, because Plugin are thread-safe
service and, like for widgets, I think it's a good and simple pratice to
be stateless for a thread_safe service. Against Java, python allow to
inject arbitrary arguments in the constructor, so avoid setter for
initialisation phase (like done by some java IoC engine).
I add two propositions (because the meaning of this features is defined
by TG, and every implementation use file to store templates):
6. Plugin expose via an attribute the extension of template files, and
it's in charge of the caller of insert/render to resolv template path.
That does seem very flexible. I imagine it working like:
def path_getter(path_list):
def find_template(template_name):
for path in path_list:
fn = os.path.join(path, template_name)
if os.path.exists(fn):
return fn
assert 0, "not found" # <- actually some specified error
return find_template
And then path_getter(template_path) could be passed in or set as an
attribute or somesuch.
The only concern I have is that it might be harder to implement or map
to systems that already have a concept of a search path. It shouldn't
be implemented purely on the frontend, because all templates (including
included or extended templates) should be found with the same mechanism.
--
Ian Bicking / [EMAIL PROTECTED] / http://blog.ianbicking.org