[viewvc-dev] Re: RSS Feeds built from queries
"Larry Shatzer, Jr." <[email protected]>
| Newsgroups | gmane.comp.version-control.cvs.viewcvs.devel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Jun 20, 2008 at 9:57 AM, Larry Shatzer, Jr. <[email protected]> wrote: > I originally thought the RSS feeds where limited by the results of the > query performed (since that is the first place I noticed the RSS feed > icon(s). It took me a while to realize it really is just the last months of > entries, built from the commit database. The wonderfulness of RSS (and other > feeds such as Atom) is you can have multiple <link>'s in the header, and > browsers (at least Firefox) will list them all so you can choose which RSS > feed to subscribe to. Attached is a first draft patch to provide a second > <link> from the query result page. The approch I took was using the [define > rss_query_href] from the query_results.ezt file. This had a knock on effect > that I had to [define rss_query_href] in most of the rest the templates. > This of course is no ideal. I guess I can also edit viewvc.py and add it to > the dictonary, to avoid having to declare it in each template that includes > header.ezt and footer.ezt. I also did not notice a variable for the url from > within the query result page, so I used the [limit_changes_href] and > retacked on the [limit_query] value to the url, along with format=rss. > > Does anyone else think this would be a worthwile thing to add to ViewVC > (RSS feeds based off the query results)? > > -- Larry > > Playing around with this again, and came up with the following patch (I'm not 100% happy with this one, but it is much simpler), plus it does not muck around with the template. The only part I am not happy with is not being able to easily reconstruct the URL and just tack on the format of rss. Is there a simpler way? This also forces all query result pages to have the query filtered RSS feed, while the other approach listed both feeds, and let the user select. [[[ Index: lib/viewvc.py =================================================================== --- lib/viewvc.py (revision 1974) +++ lib/viewvc.py (working copy) @@ -1241,10 +1241,14 @@ data['queryform_href'] = request.get_url(view_func=view_queryform, params=params, escape=1) - data['rss_href'] = request.get_url(view_func=view_query, - params={'date': 'month', - 'format': 'rss'}, - escape=1) + if request.query_dict.get('view') == 'query': + data['rss_href'] = request.get_url(view_func=view_query, + escape=1) + "&format=rss" + else: + data['rss_href'] = request.get_url(view_func=view_query, + params={'date': 'month', + 'format': 'rss'}, + escape=1) elif request.pathtype == vclib.FILE: parts = _path_parts(request.where) where = _path_join(parts[:-1]) ]]]