diff --git a/CHANGES b/CHANGES
index 56233b03..6c89795e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -30,13 +30,10 @@ Version 1.0 (not yet released)
port (2005-Dec-22)
* make "default_root" option optional. When no root is specified,
show a page listing all available repositories (2005-Feb-04)
- * make "checkout_magic" obsolete (but still enabled by default for
- URL compatibility with old versions of ViewCVS). When disabled,
- bare file URLs (with no query parameters) will return checked
- out file contents instead of log listings. That way, checkout
- URLs no longer need magic /*checkout*/ strings in them for
- relative links and image paths in checked out HTML files to work
- (2005-Feb-13)
+ * add "default_file_view" option to make it possible for relative
+ links and image paths in checked out HTML files to work without
+ the need for special /*checkout*/ prefixes in URLs. Deprecate
+ "checkout_magic" option and disable by default (2006-Apr-03)
* hide CVS "Attic" directories and add simple toggle for showing
dead files in directory listings (2004-Jul-31)
* show Unified, Context and Side-by-side diffs in HTML instead of
diff --git a/lib/config.py b/lib/config.py
index fb2161fa..7dc277d7 100644
--- a/lib/config.py
+++ b/lib/config.py
@@ -179,6 +179,8 @@ class Config:
self.cvsdb.rss_row_limit = 100
self.options.root_as_url_component = 0
+ self.options.default_file_view = "log"
+ self.options.checkout_magic = 0
self.options.sort_by = 'file'
self.options.sort_group_dirs = 1
self.options.hide_attic = 1
@@ -193,7 +195,6 @@ class Config:
self.options.allow_annotate = 1
self.options.allow_markup = 1
self.options.allow_compress = 1
- self.options.checkout_magic = 1
self.options.template_dir = "templates"
self.options.docroot = None
self.options.show_subdir_lastmod = 0
diff --git a/lib/viewvc.py b/lib/viewvc.py
index 553de19d..dce1d150 100644
--- a/lib/viewvc.py
+++ b/lib/viewvc.py
@@ -353,16 +353,13 @@ class Request:
else:
self.view_func = view_cvsgraph_image
elif self.query_dict.has_key('revision') \
- or not cfg.options.checkout_magic:
- # if checkout_magic is disabled the default view is view_checkout
- # so relative links inside checked out files will work
+ or cfg.options.default_file_view != "log":
if 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
else:
- # without checkout_magic, the default view for files is view_log
self.view_func = view_log
# if we have a directory and the request didn't end in "/", then redirect
@@ -454,13 +451,9 @@ class Request:
url = self.script_name
- # no need to explicitly specify checkout view for a file
- if view_func is view_checkout and pathtype == vclib.FILE:
- view_func = None
-
- # add checkout magic if neccessary
- if cfg.options.checkout_magic:
- url = url + '/' + checkout_magic_path
+ # add checkout magic if neccessary
+ if view_func is view_checkout and cfg.options.checkout_magic:
+ url = url + '/' + checkout_magic_path
# add root to url
rootname = None
@@ -536,6 +529,14 @@ class Request:
and params.get('r2') is not None):
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
+ 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):
+ view_func = None
+
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 52a4d989..2e4d6ff6 100644
--- a/viewvc.conf.dist
+++ b/viewvc.conf.dist
@@ -256,26 +256,31 @@ languages = en-us
#---------------------------------------------------------------------------
[options]
-### DOC
# root_as_url_component: Interpret the first path component in the URL
# after the script location as the root to use. This is an
# alternative to using the "root=" query key. If ViewVC is configured
# with multiple repositories, this results in more natural looking
-# ViewVC URLs and allows you to browse checked out HTML files with
-# relative links to other repository files within ViewVC.
+# ViewVC URLs.
# Note: Enabling this option will break backwards compatibility with
-# any old ViewVC URL which doesn't have an explicit "root" parameter.
+# any old ViewCVS URL which doesn't have an explicit "root" parameter.
root_as_url_component = 0
-# checkout_magic: Generate checkout links with a magic *checkout* prefix.
-# This option is enabled for backwards compatibility with URLs used by old
-# versions of ViewVC. If you disable it, old *checkout* URLs will continue
-# to work, but old log page urls which don't have explicit "view=log"
-# parameters will load checkout pages instead. It is recommended that you
-# disable this option in a fresh viewvc installation, or if you don't need
-# to support old-style log URLs.
-checkout_magic = 1
+# default_file_view: "log" or "co"
+# 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.
+default_file_view = log
+
+# checkout_magic: Use checkout links with magic /*checkout*/ prefixes so
+# checked out HTML pages can have working links to other repository files
+# Note: This option is DEPRECATED and should not be used in new ViewVC
+# installations. Setting "default_file_view = co" achieves the same effect
+checkout_magic = 0
# http_expiration_time: Expiration time (in seconds) for cacheable
# pages served by ViewVC. Note that in most cases, a cache aware
diff --git a/viewvc.org/upgrading.html b/viewvc.org/upgrading.html
index 3c38a9e8..59cac21b 100644
--- a/viewvc.org/upgrading.html
+++ b/viewvc.org/upgrading.html
@@ -100,19 +100,19 @@
is also possible to enable a backwards compatibility mode by
setting utc_time = 0
at the top of lib/dbi.py
In it's default configuration ViewVC 1.0 will continue to work with - bookmarks and links from old versions of ViewVC, ViewCVS, and - CVSWeb. But if you change options that affect the URL scheme, this - may no longer hold true. In particular, if you enable the - root_as_url_component option, old viewcvs URLs that - don't specify an explicit root with the root parameter - will not work. Likewise, if you disable the - checkout_magic option, old URLs that that pointed to log - pages and don't have explicit view=log parameters will - load checkout pages instead. -
+In ViewVC 1.0, the checkout_magic
option has been
+ disabled by default to provide a simpler URL scheme that works
+ safely with URL authorization. Most users will not notice any
+ difference in behavior, but users who had been using ViewCVS to
+ browse the contents of static HTML pages stored in a repository
+ may notice that links and images in those pages targetted at other
+ files in the repository no longer display correctly. The new
+ default_file_view
option can be used to solve this
+ problem and, if neccessary, checkout_magic
can also
+ be re-enabled. The viewcvs.conf
file describes these
+ options in detail.
view=co
view
parameter, not needed if the checkout_magic
configuration variable is disabled since that makes the checkout view the default view for file paths. Also not needed if the /*checkout*
magic prefix or the revision
parameter is present.
+ view
parameter, not needed if the default_file_view
configuration variable is set to co
, since that makes the checkout view the default view for file paths. Also not needed if the /*checkout*
magic prefix or the revision
parameter is present.
content-type=TYPE
view=log
view
parameter, does not need to be specified for file paths when the checkout_magic
configuration option is enabledview
parameter, does not need to be specified for file paths when the default_file_view
configuration option is set to log
. However it is recommended that the parameter be passed anyway for consistency with directory log URLs and compatibility with ViewVC installations that set default_file_view
to co
.logsort=SORT