Attachment 'moin-1.3.4-rss_rc.py-per_page_feeds.patch'
Download 1 --- MoinMoin/action/rss_rc.py 2005-01-09 10:48:07.000000000 -0800
2 +++ MoinMoin/action/rss_rc.py 2005-06-25 06:43:55.000000000 -0700
3 @@ -43,6 +43,11 @@
4 ddiffs = int(request.form.get('ddiffs', [0])[0])
5 except ValueError:
6 ddiffs = 0
7 + ## Sitewide versus local changes by Travis Snoozy <ai2097@yahoo.com>, 2005-06-25
8 + try:
9 + sitewide = int(request.form.get('sitewide', [0])[0])
10 + except ValueError:
11 + sitewide = 0
12
13 # prepare output
14 out = StringIO.StringIO()
15 @@ -63,7 +68,8 @@
16 if not request.user.may.read(line.pagename):
17 continue
18 if ((line.action[:4] != 'SAVE') or
19 - ((line.pagename in pages) and unique)): continue
20 + ((line.pagename in pages) and unique) or
21 + (not sitewide and line.pagename != pagename)): continue
22 #if log.dayChanged() and log.daycount > _MAX_DAYS: break
23 line.editor = line.getEditorData(request)[1]
24 line.time = util.datetime.tmtuple(wikiutil.version2timestamp(line.ed_time_usecs)) # UTC
25 @@ -87,17 +93,32 @@
26 ' Add "diffs=1" to add change diffs to the description of each items.\n'
27 ' \n'
28 ' Add "ddiffs=1" to link directly to the diff (good for FeedReader).\n'
29 - ' Current settings: items=%i, unique=%i, diffs=%i, ddiffs=%i'
30 - '-->\n' % (items_limit, max_items, unique, diffs, ddiffs)
31 + ' \n'
32 + ' Add "sitewide=1" to get a site-wide feed; otherwise, only differences\n'
33 + ' for the identified page will be shown.\n'
34 + ' \n'
35 + ' Current settings: items=%i, unique=%i, diffs=%i, ddiffs=%i, sitewide=%i'
36 + '-->\n' % (items_limit, max_items, unique, diffs, ddiffs, sitewide)
37 )
38
39 # emit channel description
40 - handler.startNode('channel', {
41 - (handler.xmlns['rdf'], 'about'): request.getBaseURL(),
42 - })
43 - handler.simpleNode('title', cfg.sitename)
44 - handler.simpleNode('link', interwiki + wikiutil.quoteWikinameURL(pagename))
45 - handler.simpleNode('description', 'RecentChanges at %s' % cfg.sitename)
46 + if sitewide:
47 + # Site-wide feed
48 + handler.startNode('channel', {
49 + (handler.xmlns['rdf'], 'about'): request.getBaseURL(),
50 + })
51 + handler.simpleNode('title', cfg.sitename)
52 + handler.simpleNode('link', request.getBaseURL())
53 + handler.simpleNode('description', 'RecentChanges at %s' % cfg.sitename)
54 + else:
55 + # Page-specific feed
56 + handler.startNode('channel', {
57 + (handler.xmlns['rdf'], 'about'): request.getBaseURL() + request.getPathinfo(),
58 + })
59 + handler.simpleNode('title', cfg.sitename + " " + pagename)
60 + handler.simpleNode('link', interwiki + wikiutil.quoteWikinameURL(pagename))
61 + handler.simpleNode('description', 'RecentChanges to %s at %s' % (pagename, cfg.sitename))
62 +
63 if logo:
64 handler.simpleNode('image', None, {
65 (handler.xmlns['rdf'], 'resource'): logo,
66 @@ -139,7 +160,7 @@
67 # general attributes
68 handler.simpleNode('title', item.pagename)
69 if ddiffs:
70 - handler.simpleNode('link', link+"?action=diff")
71 + handler.simpleNode('link', link+"?action=diff&rev1="+str(int(item.rev)-1)+"&rev2="+str(int(item.rev)))
72 else:
73 handler.simpleNode('link', link)
74
75 @@ -148,19 +169,7 @@
76 # description
77 desc_text = item.comment
78 if diffs:
79 - # TODO: rewrite / extend wikiutil.pagediff
80 - # searching for the matching pages doesn't really belong here
81 - revisions = page.getRevList()
82 -
83 - rl = len(revisions)
84 - for idx in range(rl):
85 - rev = revisions[idx]
86 - if rev <= item.rev:
87 - if idx+1 < rl:
88 - lines = wikiutil.pagediff(request, item.pagename, revisions[idx+1], item.pagename, 0, ignorews=1)
89 - if len(lines) > 20: lines = lines[:20] + ['...\n']
90 - desc_text = '%s\n<pre>\n%s\n</pre>\n' % (desc_text, '\n'.join(lines))
91 - break
92 + desc_text = '%s\n<pre>\n%s\n</pre>\n' % (desc_text, '\n'.join(wikiutil.pagediff(request, item.pagename, (int(item.rev)-1), item.pagename, int(item.rev), ignorews=1)))
93 if desc_text:
94 handler.simpleNode('description', desc_text)
95
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.