I've been looking at the code to get started on the pkg_resources pull request, but I want to get the basic logic squared with you first.
I'm looking at L42.
It looks like app_subdir
is ignored if root_dir
is specified. This seems a little counterintuitive.
Also, if a / is present in template
, this is taken to mean that the part before the slash is an app. What if this is instead meant to be a subdirectory of the app_subdir
directory? Moreover, if no / is present in template
, nothing is done at all.
So the template should either be at:
root_dir/template
template[0]/app_subdir/template[1:]
This is confusing, since you're doing some undocumented parsing on the template
, in a place where I really would not expect that.
Looking at the documentation, and the init parameters, I would expect:
root_dir/template
if app_subdir is None
root_dir/app_subdir/template
My pull request would add:
application/app_subdir/template
where application path is loaded by pkg_resources
Every time I think of a way to simplify this API, I get the strong urge to just use the built-in jinja template loader options, since they provide the same functionality but with a cleaner API.
if you really want to keep using this, I would propose to rename root_dir
to absolute_path
, and app_subdir
to template_subdir
for clarity 's sake. I would also append templates_subdir
to absolute_path
, and remove all template
parsing in favour of the pkg_resources
resource manager API.