diff --git a/CHANGES b/CHANGES index 9062d5b3..e7606a20 100644 --- a/CHANGES +++ b/CHANGES @@ -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) diff --git a/lib/viewvc.py b/lib/viewvc.py index ee7cd145..c6fa9d62 100644 --- a/lib/viewvc.py +++ b/lib/viewvc.py @@ -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 diff --git a/viewvc.conf.dist b/viewvc.conf.dist index ae9a85a2..78f676bb 100644 --- a/viewvc.conf.dist +++ b/viewvc.conf.dist @@ -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