Interpret the per-template override options as relative to the

configured template directory now.

* lib/viewvc.py
  (get_view_template): Rework this to interpret per-template overrides
    as relative to the template-dir, which itself is relative to the
    configuration location.

* viewvc.conf.dist
  (templates): Strip 'templates/' from the sample template locations,
    and note that these paths are relative to the configured template
    directory.

* docs/upgrading-howto.html
  Note this change of interpretation.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1953 8cb11bc2-c004-0410-86c3-e597b4017df7
remotes/tags/1.1.0-beta1
cmpilato 2008-06-12 18:24:28 +00:00
parent fb0264a563
commit 079b596424
3 changed files with 30 additions and 23 deletions

View File

@ -323,6 +323,12 @@ allow_tar = 1
annotate.ezt templates have been combined into a single file.ezt
template.</p>
<p>Also, the configuration options under the <code>[templates]</code>
section are now paths relative to the configured template directory
(either the value of the <code>options/template_dir</code>
option, or the default "templates" directory), instead of being
relative to the configuration location.</p>
<table>
<thead>
<tr>

View File

@ -842,18 +842,18 @@ def check_freshness(request, mtime=None, etag=None, weak=0):
return isfresh
def get_view_template(cfg, view_name, language="en"):
# see if the configuration specifies a template for this view
tname = vars(cfg.templates).get(view_name)
# See if the configuration specifies a template for this view. If
# not, use the default template path for this view.
tname = vars(cfg.templates).get(view_name) or view_name + ".ezt"
# if there is no specific template definition for this view, look in
# the default location (relative to the configured template_dir)
if not tname:
tname = os.path.join(cfg.options.template_dir, view_name + ".ezt")
# Template paths are relative to the configurated template_dir (if
# any, "templates" otherwise), so build the template path as such.
tname = os.path.join(cfg.options.template_dir or "templates", tname)
# allow per-language template selection
# Allow per-language template selection.
tname = string.replace(tname, '%lang%', language)
# finally, construct the whole template path.
# Finally, construct the whole template path.
tname = cfg.path(tname)
debug.t_start('ezt-parse')

View File

@ -526,8 +526,9 @@ limit_changes = 100
# appropriate option below and specify the currect location of the EZT
# template file you wish to use for that view.
#
# Templates are specified relative to the directory where this config
# file resides, but absolute paths may also be used as well.
# Templates are specified relative to the configured template
# directory (see the "template_dir" option), but absolute paths may
# also be used as well.
#
# If %lang% occurs in the pathname, then the selected language will be
# substituted.
@ -536,21 +537,21 @@ limit_changes = 100
# [general] section, and based on the request's Accept-Language
# header.
#
#diff = templates/diff.ezt
#directory = templates/directory.ezt
#diff = diff.ezt
#directory = directory.ezt
### an alternative directory view
#directory = templates/dir_new.ezt
#error = templates/error.ezt
#file = templates/file.ezt
#graph = templates/graph.ezt
#log = templates/log.ezt
#directory = dir_new.ezt
#error = error.ezt
#file = file.ezt
#graph = graph.ezt
#log = log.ezt
### a table-based alternative log view
#log = templates/log_table.ezt
#query = templates/query.ezt
#query_form = templates/query_form.ezt
#query_results = templates/query_results.ezt
#revision = templates/revision.ezt
#roots = templates/roots.ezt
#log = log_table.ezt
#query = query.ezt
#query_form = query_form.ezt
#query_results = query_results.ezt
#revision = revision.ezt
#roots = roots.ezt
#---------------------------------------------------------------------------
[cvsdb]