[viewvc-dev] RSS Feed templates and links

"Larry Shatzer, Jr." <[email protected]>
Newsgroups gmane.comp.version-control.cvs.viewcvs.devel
Message-ID <[email protected]>
I've been "hacking" a lot lately with ViewVC (hence all my patches, and
such). Anyway, I find the RSS feeds only somewhat useful, especially in the
case of the CVS ones. In the Subversion ones we have the link to the actual
revision, which is great, since there you can get an idea what changed. In
CVS, there is no such link, and I understand why (global revision number vs.
per file revisions).

Looking at the template hacking guide, I noticed there is [commits.files],
which lists each of the files in the commit. This is great, since I can
update the template to loop over each file, and output them. To be more
userfriendly I have hyperlinked certain bits of data straight to ViewVC (via
[commits.files.dir_href] and other href options). The problem is this link
is relative, which is fine within the confines of your browser, where it can
figure out where to go. If you use a RSS feed reader, the links do not work.

For my copy of ViewVC I just hardcoded the servername, which works find for
me, but not an ideal solution. Looking at the code, I see get_url() takes a
prefix option to determine if the prefix to the url will be kept. I think
all href links that pass through get_url() should have prefix set to 1.
Unless there is some other option in RSS to set the base href for all links
(which I kinda doubt). Below is a "hack" that works, but I'm not fully
comfortable with it, since it overrides a default just for rss formats,
which smells to me.

-- Larry

[[[
Index: lib/viewvc.py
===================================================================
--- lib/viewvc.py       (revision 1960)
+++ lib/viewvc.py       (working copy)
@@ -399,6 +399,9 @@
     split into components.  If PREFIX is set, include the protocol and
     server name portions of the URL."""

+    if(self.query_dict.get('format') == 'rss'):
+      prefix = 1
+
     url, params = apply(self.get_link, (), args)
     qs = compat.urlencode(params)
     if qs:
]]]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.