Finish issue #305 by allowing "markup" to be the configured default

file view.  This causes less-than-perfectly-compact URL generation in
some cases, but frankly, we'd have fewer URL-compatibility issues if
we hadn't been trying to discard information in the first place.

* lib/viewvc.py
  (Request.run_viewvc, Request.get_link): Honor "markup" as a valid value for
    default_file_view.

* viewvc.conf.dist
  (default_file_view): Note that "markup" is now a valid option here.

* CHANGES
  Record this change.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1775 8cb11bc2-c004-0410-86c3-e597b4017df7
remotes/merged-file-views
cmpilato 2008-02-11 22:16:00 +00:00
parent 47ad6e149c
commit cedb97c3d4
3 changed files with 19 additions and 11 deletions

View File

@ -23,6 +23,7 @@ Version 1.1.0 (released ??-???-????)
- Subversion authz files
- regexp-based path hiding
- file glob top-level directory hiding (for compat with 1.0.x)
* allow default file view to be "markup" (issue #305)
Version 1.0.4 (released 10-Apr-2007)

View File

@ -330,8 +330,9 @@ class Request:
self.view_func = view_cvsgraph_image
elif self.query_dict.has_key('revision') \
or cfg.options.default_file_view != "log":
if self.query_dict.get('content-type', None) in (viewcvs_mime_type,
alt_mime_type):
if cfg.options.default_file_view == "markup" \
or self.query_dict.get('content-type', None) \
in (viewcvs_mime_type, alt_mime_type):
self.view_func = view_markup
else:
self.view_func = view_checkout
@ -512,13 +513,19 @@ class Request:
view_func = None
# no need to explicitly specify checkout view when it's the default
# view, when checkout_magic is enabled, or when "revision" is present
# view or when checkout_magic is enabled
if view_func is view_checkout:
if ((cfg.options.default_file_view != "log" and pathtype == vclib.FILE)
or cfg.options.checkout_magic
or params.get('revision') is not None):
if ((cfg.options.default_file_view == "co" and pathtype == vclib.FILE)
or cfg.options.checkout_magic):
view_func = None
# no need to explicitly specify markup view when it's the default view
if view_func is view_markup:
if (cfg.options.default_file_view == "markup" \
and pathtype == vclib.FILE):
view_func = None
# set the view parameter
view_code = _view_codes.get(view_func)
if view_code and not (params.has_key('view') and params['view'] is None):
params['view'] = view_code

View File

@ -330,16 +330,16 @@ authorizer = forbidden
# addresses that appear in version control metadata (e.g. log messages).
mangle_email_addresses = 0
# default_file_view: "log" or "co"
# default_file_view: "log", "co", or "markup"
# Controls whether the default view for file URLs is a checkout view or
# a log view. "log" is the default for backwards compatibility with old
# ViewCVS URLs, but "co" has the advantage that it allows ViewVC to serve
# static HTML pages directly from a repository with working links
# to other repository files
# Note: Changing this option may cause old ViewCVS URLs that referred
# to log pages to load checkout pages instead.
# Also note: If you choose the "co" view, be sure to enable it (via
# the allowed_views option)
# Note: Changing this option may break compatibility with existing
# bookmarked URLs.
# Also note: If you choose one of the "co" or "markup" views, be sure
# to enable it (via the allowed_views option)
default_file_view = log
# http_expiration_time: Expiration time (in seconds) for cacheable