Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with template lookup and mod_wsgi #387

Closed
Marrin opened this issue Oct 15, 2012 · 1 comment
Closed

Problem with template lookup and mod_wsgi #387

Marrin opened this issue Oct 15, 2012 · 1 comment

Comments

@Marrin
Copy link

Marrin commented Oct 15, 2012

I have a problem with template lookup and mod_wsgi. A template name seems to be always looked up in the current working directory first and there is nothing I can do about it. It's the first line of BaseTemplate.search().

As the current working directory under mod_wsgi could be anything it is easy to pick up wrong files. I have an index.html template in the views/ directory and adapted bottle.TEMPLATE_PATH. I get almost all templates from there but the index.html is picked up from /var/www/ and is of course not the template file I wanted to load.

Renaming the template is a workaround but IMHO not a good permanent solution.

@defnull
Copy link
Member

defnull commented Oct 17, 2012

I'm working on a fix for this release and will change the behaviour completely in the next one. Templates should never be loaded from anywhere but the lookup directories.

defnull added a commit that referenced this issue Oct 17, 2012
fix #386: Response cookies cleared after redirect()
fix #389: Bottle still raises DeprecationWarning in bottle.redirect() and Router.match()
Fix #387: Template lookup found files in workdir, even if TEMPLATE_PATH did not contain '.'.
fix #382: "dictionary changed size during iteration" bug in test case.
defnull added a commit that referenced this issue Oct 17, 2012
…TH did not contain '.'.

The template path list is now obeyed (with an exception for templates with an explicit absolute path).

The next release will tighten the rules a bit further: TEMPLATE_PATH must not be empty, and absolute paths are
considered relative, too. This ensures that only templates from within TEMPLATE_PATH directries are loaded.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants