RSS Local Filter
This modification on action/rss_rc.py adds a functionality to limit the RSS feed for the current page and its subpages.
Feature
The current MoinMoin RSS feeds all the changes in the target site. But someone has interests on a part of pages only, and does not want to get feeds for the entire changes in the site.
- Using this modification, you can limit the RSS feed for a target page and its subpages only.
Usage
- add 'local=1' to the URL parameters of rss_rc action in the target page.
E.g., I'd like to aggregate the changes on PersonalArticles page and its subpages only.
http://YOUR_HOME/mywiki/moin.cgi/PersonalArticles?action=rss_rc&local=1
Platform Support
- Tested on/with:
MoinMoin 1.3.5
- Windows XP
- Python 2.4
Sample
Try RSS feed for my personal articles: http://angel.icu.ac.kr/~silee/PersonalArticles?action=rss_rc&local=1 {ko}
Note that my wiki given above limits RSS feeds on PersonalArticles only even if local option is not used.
How to apply
- in action/rss_rc.py
--- rss_rc-1.3.5.py 2005-06-27 00:43:06.000000000 +0900 +++ rss_rc.py 2005-10-21 13:03:01.671875000 +0900 @@ -43,7 +43,12 @@ ddiffs = int(request.form.get('ddiffs', [0])[0]) except ValueError: ddiffs = 0 - + + try: + local = int(request.form.get('local', [0])[0]) + except ValueError: + local = 0 + # prepare output out = StringIO.StringIO() handler = RssGenerator(out) @@ -62,6 +67,12 @@ for line in log.reverse(): if not request.user.may.read(line.pagename): continue + + if (local == 1): + pagename_len = len(pagename) + if (line.pagename[:pagename_len] != pagename): + continue + if ((line.action[:4] != 'SAVE') or ((line.pagename in pages) and unique)): continue #if log.dayChanged() and log.daycount > _MAX_DAYS: break
-- SeungikLee 2005-10-21 04:47:10
Discussion
- Please use .startswith() to prefix-compare 2 strings!
- An interesting addition to this would be to allow a regex-param (subscribe to a pattern); since there can be more such modifications, a better solution would be to use "scope=local" instead of "local=1", so that you can add "scope=regex:.*Comment" etc. Default would be "scope=global".
See FeatureRequests/LimitedRecentChanges. -- JohannesBerg 2006-07-20 13:58:01
It would be nice if a <link rel="alternate" title="PageName changes" type="application/rss+xml" href="..."> could be inserted into the <head> element for all pages. The href attribute would point at the URL of the feed for the current page. This allows browsers to detect that a feed is available (and is already done on the RecentChanges page). -- SamMorris 2008-07-01 23:18:08