annotate MoinMoin/action/rss_rc.py @ 5910:7e7e1cbb9d3f

security: fix remote code execution vulnerability in twikidraw/anywikidraw actions We have wikiutil.taintfilename() to make user supplied filenames safe, so that they can't contain any "special" characters like path separators, etc. It is used at many places in moin, but wasn't used here. :|
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 29 Dec 2012 15:05:29 +0100
parents de8ebe586126
children aee4ff651134
rev   line source
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
2 RSS Handling
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
3
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
4 If you do changes, please check if it still validates after your changes:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
5
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
6 http://feedvalidator.org/
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
7
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1816
diff changeset
8 @copyright: 2006-2007 MoinMoin:ThomasWaldmann
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
9 @license: GNU GPL, see COPYING for details.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
10 """
1791
6dd2e29acffe Eclipse PyDev Check: fixed lots of its errors and warnings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1665
diff changeset
11 import StringIO, re, time
476
4be11eec9c4f MoinMoin.util.datetime -> timefuncs to avoid conflict/confusion with stdlib datetime, also moved util.W3CDate there
Thomas Waldmann <tw@waldmann-edv.de>
parents: 108
diff changeset
12 from MoinMoin import wikixml, config, wikiutil
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
13 from MoinMoin.logfile import editlog
476
4be11eec9c4f MoinMoin.util.datetime -> timefuncs to avoid conflict/confusion with stdlib datetime, also moved util.W3CDate there
Thomas Waldmann <tw@waldmann-edv.de>
parents: 108
diff changeset
14 from MoinMoin.util import timefuncs
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
15 from MoinMoin.Page import Page
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
16 from MoinMoin.wikixml.util import RssGenerator
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
17 from MoinMoin.action import AttachFile
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
18
1665
c57f72b49ea2 cleanup rss_rc action, use page.url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1184
diff changeset
19 def full_url(request, page, querystr=None, anchor=None):
3234
a739558ca3dc Page.url() default changed to relative=False
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2450
diff changeset
20 url = page.url(request, anchor=anchor, querystr=querystr)
1816
4a31739bc6e1 Page.url(): removed escaping support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1799
diff changeset
21 return request.getQualifiedURL(url)
1665
c57f72b49ea2 cleanup rss_rc action, use page.url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1184
diff changeset
22
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
23 def attach_url(request, pagename, filename, do):
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
24 url = AttachFile.getAttachUrl(pagename, filename, request, do=do)
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
25 return request.getQualifiedURL(url)
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
26
5845
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
27 def match_page(pagename, page_pattern):
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
28 # Match everything for empty pattern
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
29 if not page_pattern:
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
30 return True
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
31 # If pattern begins with circumflex, interpret it as regex
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
32 elif page_pattern[0] == "^":
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
33 return re.match(page_pattern, pagename) is not None
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
34 # Handy hack for getting rss for page tree
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
35 elif page_pattern.endswith("/"):
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
36 return (pagename == page_pattern[:-1]) or \
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
37 pagename.startswith(page_pattern)
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
38 else:
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
39 return pagename == page_pattern
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
40
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
41 def execute(pagename, request):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
42 """ Send recent changes as an RSS document
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
43 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
44 if not wikixml.ok:
4183
fc20a076aad0 Accomodate for consolidation of Request/Response
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4176
diff changeset
45 request.mimetype = 'text/plain'
1799
06ce4843b9b5 remove some XXX strings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1791
diff changeset
46 request.write("rss_rc action is not supported because of missing pyxml module.")
06ce4843b9b5 remove some XXX strings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1791
diff changeset
47 return
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
48
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
49 cfg = request.cfg
5843
89fbca5396a1 action/rss_rc.py: proper support of rename, revert, page creation.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5842
diff changeset
50 _ = request.getText
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
51
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
52 # get params
5851
ab0bc2441518 action/rss_rc.py: Retrieval of configuration options changed from getattr() since they are in config now already. Last rev which does not depend on configuration options presence: 468e63254a4a.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5848
diff changeset
53 def_max_items = max_items = cfg.rss_items_default
ab0bc2441518 action/rss_rc.py: Retrieval of configuration options changed from getattr() since they are in config now already. Last rev which does not depend on configuration options presence: 468e63254a4a.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5848
diff changeset
54 items_limit = cfg.rss_items_limit
ab0bc2441518 action/rss_rc.py: Retrieval of configuration options changed from getattr() since they are in config now already. Last rev which does not depend on configuration options presence: 468e63254a4a.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5848
diff changeset
55 unique = cfg.rss_unique
ab0bc2441518 action/rss_rc.py: Retrieval of configuration options changed from getattr() since they are in config now already. Last rev which does not depend on configuration options presence: 468e63254a4a.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5848
diff changeset
56 diffs = cfg.rss_diffs
ab0bc2441518 action/rss_rc.py: Retrieval of configuration options changed from getattr() since they are in config now already. Last rev which does not depend on configuration options presence: 468e63254a4a.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5848
diff changeset
57 ddiffs = cfg.rss_ddiffs
ab0bc2441518 action/rss_rc.py: Retrieval of configuration options changed from getattr() since they are in config now already. Last rev which does not depend on configuration options presence: 468e63254a4a.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5848
diff changeset
58 max_lines = cfg.rss_lines_default
ab0bc2441518 action/rss_rc.py: Retrieval of configuration options changed from getattr() since they are in config now already. Last rev which does not depend on configuration options presence: 468e63254a4a.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5848
diff changeset
59 lines_limit = cfg.rss_lines_limit
ab0bc2441518 action/rss_rc.py: Retrieval of configuration options changed from getattr() since they are in config now already. Last rev which does not depend on configuration options presence: 468e63254a4a.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5848
diff changeset
60 show_att = cfg.rss_show_attachment_entries
ab0bc2441518 action/rss_rc.py: Retrieval of configuration options changed from getattr() since they are in config now already. Last rev which does not depend on configuration options presence: 468e63254a4a.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5848
diff changeset
61 page_pattern = cfg.rss_page_filter_pattern
5841
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5840
diff changeset
62
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
63 try:
5841
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5840
diff changeset
64 max_items = min(int(request.values.get('items', max_items)),
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5840
diff changeset
65 items_limit)
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5840
diff changeset
66 except ValueError:
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5840
diff changeset
67 pass
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
68 try:
5841
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5840
diff changeset
69 unique = int(request.values.get('unique', unique))
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
70 except ValueError:
5841
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5840
diff changeset
71 pass
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
72 try:
5841
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5840
diff changeset
73 diffs = int(request.values.get('diffs', diffs))
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
74 except ValueError:
5841
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5840
diff changeset
75 pass
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
76 ## ddiffs inserted by Ralf Zosel <ralf@zosel.com>, 04.12.2003
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
77 try:
5841
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5840
diff changeset
78 ddiffs = int(request.values.get('ddiffs', ddiffs))
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
79 except ValueError:
5841
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5840
diff changeset
80 pass
5840
4a982b04461d action/rss_rc.py: new option - lines - set max lines for diff/content shown in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5839
diff changeset
81 try:
5841
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5840
diff changeset
82 max_lines = min(int(request.values.get('lines', max_lines)),
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5840
diff changeset
83 lines_limit)
5840
4a982b04461d action/rss_rc.py: new option - lines - set max lines for diff/content shown in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5839
diff changeset
84 except ValueError:
5841
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5840
diff changeset
85 pass
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
86 try:
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
87 show_att = int(request.values.get('show_att', show_att))
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
88 except ValueError:
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
89 pass
5845
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
90 try:
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
91 page_pattern = request.values.get('page', page_pattern)
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
92 except ValueError:
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
93 pass
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
94
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
95 # get data
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
96 log = editlog.EditLog(request)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
97 logdata = []
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
98 counter = 0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
99 pages = {}
15
5a2a8201bb6f make moin friendlier to proxies, thanks to ASF
Thomas Waldmann <tw@waldmann-edv.de>
parents: 0
diff changeset
100 lastmod = 0
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
101 for line in log.reverse():
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
102 if not request.user.may.read(line.pagename):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
103 continue
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
104 if ((not show_att and not line.action.startswith('SAVE')) or
5845
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
105 ((line.pagename in pages) and unique) or
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
106 not match_page(line.pagename, page_pattern)):
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
107 continue
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
108 line.editor = line.getInterwikiEditorData(request)
476
4be11eec9c4f MoinMoin.util.datetime -> timefuncs to avoid conflict/confusion with stdlib datetime, also moved util.W3CDate there
Thomas Waldmann <tw@waldmann-edv.de>
parents: 108
diff changeset
109 line.time = timefuncs.tmtuple(wikiutil.version2timestamp(line.ed_time_usecs)) # UTC
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
110 logdata.append(line)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
111 pages[line.pagename] = None
15
5a2a8201bb6f make moin friendlier to proxies, thanks to ASF
Thomas Waldmann <tw@waldmann-edv.de>
parents: 0
diff changeset
112
5a2a8201bb6f make moin friendlier to proxies, thanks to ASF
Thomas Waldmann <tw@waldmann-edv.de>
parents: 0
diff changeset
113 if not lastmod:
5a2a8201bb6f make moin friendlier to proxies, thanks to ASF
Thomas Waldmann <tw@waldmann-edv.de>
parents: 0
diff changeset
114 lastmod = wikiutil.version2timestamp(line.ed_time_usecs)
5a2a8201bb6f make moin friendlier to proxies, thanks to ASF
Thomas Waldmann <tw@waldmann-edv.de>
parents: 0
diff changeset
115
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
116 counter += 1
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
117 if counter >= max_items:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
118 break
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
119 del log
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
120
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
121 timestamp = timefuncs.formathttpdate(lastmod)
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
122 etag = "%d-%d-%d-%d-%d-%d-%d" % (lastmod, max_items, diffs, ddiffs, unique,
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
123 max_lines, show_att)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
124
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
125 # for 304, we look at if-modified-since and if-none-match headers,
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
126 # one of them must match and the other is either not there or must match.
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
127 if request.if_modified_since == timestamp:
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
128 if request.if_none_match:
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
129 if request.if_none_match == etag:
4183
fc20a076aad0 Accomodate for consolidation of Request/Response
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4176
diff changeset
130 request.status_code = 304
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
131 else:
4183
fc20a076aad0 Accomodate for consolidation of Request/Response
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4176
diff changeset
132 request.status_code = 304
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
133 elif request.if_none_match == etag:
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
134 if request.if_modified_since:
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
135 if request.if_modified_since == timestamp:
4183
fc20a076aad0 Accomodate for consolidation of Request/Response
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4176
diff changeset
136 request.status_code = 304
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
137 else:
4183
fc20a076aad0 Accomodate for consolidation of Request/Response
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4176
diff changeset
138 request.status_code = 304
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
139 else:
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
140 # generate an Expires header, using whatever setting the admin
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
141 # defined for suggested cache lifetime of the RecentChanges RSS doc
4176
85884c67228d Replaced/removed calls to request.emit_http_headers
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 3234
diff changeset
142 expires = time.time() + cfg.rss_cache
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
143
5629
32a0bf3c4e43 fix Content-Type header (mimetype) for rss_rc and sisterpages actions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5591
diff changeset
144 request.mimetype = 'application/rss+xml'
4183
fc20a076aad0 Accomodate for consolidation of Request/Response
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4176
diff changeset
145 request.expires = expires
fc20a076aad0 Accomodate for consolidation of Request/Response
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4176
diff changeset
146 request.last_modified = lastmod
5591
1dff6cfdcf90 http headers: for most cases, do not use .add, but .__setitem__
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4424
diff changeset
147 request.headers['Etag'] = etag
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
148
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
149 # send the generated XML document
4334
7add275cf4de Fixed: deprecated (and missing) getBaseURL() method
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4201
diff changeset
150 baseurl = request.url_root
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
151
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
152 logo = re.search(r'src="([^"]*)"', cfg.logo_string)
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
153 if logo:
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
154 logo = request.getQualifiedURL(logo.group(1))
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
155
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
156 # prepare output
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
157 out = StringIO.StringIO()
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
158 handler = RssGenerator(out)
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
159
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
160 # start SAX stream
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
161 handler.startDocument()
5846
a1054c9e7aae [bugfix] action/rss_rc.py: dealing with mixing unicode and non-unicode strings.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5845
diff changeset
162 handler._out.write(unicode(
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
163 '<!--\n'
5847
2191676ba6fe action/rss_rc.py: comment insertion code changed in flavor of using named placeholders.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5846
diff changeset
164 ' Add an "items=nnn" URL parameter to get more than the \n'
2191676ba6fe action/rss_rc.py: comment insertion code changed in flavor of using named placeholders.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5846
diff changeset
165 ' default %(def_max_items)d items. You cannot get more than \n'
2191676ba6fe action/rss_rc.py: comment insertion code changed in flavor of using named placeholders.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5846
diff changeset
166 ' %(items_limit)d items though.\n'
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
167 ' \n'
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
168 ' Add "unique=1" to get a list of changes where page names are unique,\n'
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
169 ' i.e. where only the latest change of each page is reflected.\n'
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
170 ' \n'
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
171 ' Add "diffs=1" to add change diffs to the description of each items.\n'
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
172 ' \n'
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
173 ' Add "ddiffs=1" to link directly to the diff (good for FeedReader).\n'
5840
4a982b04461d action/rss_rc.py: new option - lines - set max lines for diff/content shown in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5839
diff changeset
174 ' \n'
4a982b04461d action/rss_rc.py: new option - lines - set max lines for diff/content shown in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5839
diff changeset
175 ' Add "lines=nnn" to change maximum number of diff/body lines \n'
5847
2191676ba6fe action/rss_rc.py: comment insertion code changed in flavor of using named placeholders.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5846
diff changeset
176 ' to show. Cannot be more than %(lines_limit)d.\n'
5840
4a982b04461d action/rss_rc.py: new option - lines - set max lines for diff/content shown in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5839
diff changeset
177 ' \n'
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
178 ' Add "show_att=1" to show items related to attachments.\n'
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
179 ' \n'
5845
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
180 ' Add "page=pattern" to show feed only for specific pages.\n'
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
181 ' Pattern can be empty (it would match to all pages), \n'
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
182 ' can start with circumflex (it would be interpreted as \n'
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
183 ' regular expression in this case), end with slash (for \n'
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
184 ' getting feed for page tree) or point to specific page (if \n'
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
185 ' none of the above can be applied).\n'
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
186 ' \n'
5847
2191676ba6fe action/rss_rc.py: comment insertion code changed in flavor of using named placeholders.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5846
diff changeset
187 ' Current settings: items=%(max_items)i, unique=%(unique)i, \n'
2191676ba6fe action/rss_rc.py: comment insertion code changed in flavor of using named placeholders.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5846
diff changeset
188 ' diffs=%(diffs)i, ddiffs=%(ddiffs)i, lines=%(max_lines)i, \n'
5854
de8ebe586126 action/rss_rc.py: removed addition of page_pattern URL parameter value in RSS description comment to prevent possible arbitrary code injection issues.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5853
diff changeset
189 ' show_att=%(show_att)i\n'
5847
2191676ba6fe action/rss_rc.py: comment insertion code changed in flavor of using named placeholders.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5846
diff changeset
190 '-->\n' % locals()
5846
a1054c9e7aae [bugfix] action/rss_rc.py: dealing with mixing unicode and non-unicode strings.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5845
diff changeset
191 ).encode(config.charset))
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
192
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
193 # emit channel description
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
194 handler.startNode('channel', {
4334
7add275cf4de Fixed: deprecated (and missing) getBaseURL() method
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4201
diff changeset
195 (handler.xmlns['rdf'], 'about'): request.url_root,
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
196 })
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
197 handler.simpleNode('title', cfg.sitename)
1665
c57f72b49ea2 cleanup rss_rc action, use page.url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1184
diff changeset
198 page = Page(request, pagename)
c57f72b49ea2 cleanup rss_rc action, use page.url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1184
diff changeset
199 handler.simpleNode('link', full_url(request, page))
5848
468e63254a4a action/rss_rc.py: forcing unicode for comment strings.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5847
diff changeset
200 handler.simpleNode('description', u'RecentChanges at %s' % cfg.sitename)
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
201 if logo:
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
202 handler.simpleNode('image', None, {
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
203 (handler.xmlns['rdf'], 'resource'): logo,
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
204 })
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
205 if cfg.interwikiname:
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
206 handler.simpleNode(('wiki', 'interwiki'), cfg.interwikiname)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
207
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
208 handler.startNode('items')
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
209 handler.startNode(('rdf', 'Seq'))
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
210 for item in logdata:
1665
c57f72b49ea2 cleanup rss_rc action, use page.url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1184
diff changeset
211 anchor = "%04d%02d%02d%02d%02d%02d" % item.time[:6]
c57f72b49ea2 cleanup rss_rc action, use page.url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1184
diff changeset
212 page = Page(request, item.pagename)
c57f72b49ea2 cleanup rss_rc action, use page.url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1184
diff changeset
213 link = full_url(request, page, anchor=anchor)
c57f72b49ea2 cleanup rss_rc action, use page.url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1184
diff changeset
214 handler.simpleNode(('rdf', 'li'), None, attr={(handler.xmlns['rdf'], 'resource'): link, })
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
215 handler.endNode(('rdf', 'Seq'))
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
216 handler.endNode('items')
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
217 handler.endNode('channel')
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
218
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
219 # emit logo data
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
220 if logo:
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
221 handler.startNode('image', attr={
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
222 (handler.xmlns['rdf'], 'about'): logo,
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
223 })
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
224 handler.simpleNode('title', cfg.sitename)
1665
c57f72b49ea2 cleanup rss_rc action, use page.url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1184
diff changeset
225 handler.simpleNode('link', baseurl)
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
226 handler.simpleNode('url', logo)
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
227 handler.endNode('image')
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
228
5843
89fbca5396a1 action/rss_rc.py: proper support of rename, revert, page creation.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5842
diff changeset
229 # Mapping { oldname: curname } for maintaining page renames
89fbca5396a1 action/rss_rc.py: proper support of rename, revert, page creation.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5842
diff changeset
230 pagename_map = {}
89fbca5396a1 action/rss_rc.py: proper support of rename, revert, page creation.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5842
diff changeset
231
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
232 # emit items
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
233 for item in logdata:
5843
89fbca5396a1 action/rss_rc.py: proper support of rename, revert, page creation.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5842
diff changeset
234 if item.pagename in pagename_map:
89fbca5396a1 action/rss_rc.py: proper support of rename, revert, page creation.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5842
diff changeset
235 cur_pagename = pagename_map[item.pagename]
89fbca5396a1 action/rss_rc.py: proper support of rename, revert, page creation.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5842
diff changeset
236 else:
89fbca5396a1 action/rss_rc.py: proper support of rename, revert, page creation.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5842
diff changeset
237 cur_pagename = item.pagename
89fbca5396a1 action/rss_rc.py: proper support of rename, revert, page creation.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5842
diff changeset
238 page = Page(request, cur_pagename)
89fbca5396a1 action/rss_rc.py: proper support of rename, revert, page creation.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5842
diff changeset
239 action = item.action
89fbca5396a1 action/rss_rc.py: proper support of rename, revert, page creation.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5842
diff changeset
240 comment = item.comment
1665
c57f72b49ea2 cleanup rss_rc action, use page.url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1184
diff changeset
241 anchor = "%04d%02d%02d%02d%02d%02d" % item.time[:6]
c57f72b49ea2 cleanup rss_rc action, use page.url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1184
diff changeset
242 rdflink = full_url(request, page, anchor=anchor)
c57f72b49ea2 cleanup rss_rc action, use page.url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1184
diff changeset
243 handler.startNode('item', attr={(handler.xmlns['rdf'], 'about'): rdflink, })
15
5a2a8201bb6f make moin friendlier to proxies, thanks to ASF
Thomas Waldmann <tw@waldmann-edv.de>
parents: 0
diff changeset
244
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
245 # general attributes
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
246 handler.simpleNode('title', item.pagename)
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
247 handler.simpleNode(('dc', 'date'), timefuncs.W3CDate(item.time))
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
248
5843
89fbca5396a1 action/rss_rc.py: proper support of rename, revert, page creation.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5842
diff changeset
249 show_diff = diffs
89fbca5396a1 action/rss_rc.py: proper support of rename, revert, page creation.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5842
diff changeset
250
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
251 if action.startswith('ATT'): # Attachment
5843
89fbca5396a1 action/rss_rc.py: proper support of rename, revert, page creation.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5842
diff changeset
252 show_diff = 0
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
253 filename = wikiutil.url_unquote(item.extra)
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
254 att_exists = AttachFile.exists(request, cur_pagename, filename)
5839
d415cb95645c action/rss_rc.py: proper links to appropriate diffs when ddiffs=1 and proper link/content for log entry related to new page.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5838
diff changeset
255
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
256 if action == 'ATTNEW':
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
257 # Once attachment deleted this link becomes invalid but we
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
258 # preserve it to prevent appearance of new RSS entries in
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
259 # RSS readers.
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
260 if ddiffs:
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
261 handler.simpleNode('link', attach_url(request,
5853
e1a4caec2513 [minor] rss_rc: subaction in link for ATTNEW feed entries changed from get to view as less surprising.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5851
diff changeset
262 cur_pagename, filename, do='view'))
5839
d415cb95645c action/rss_rc.py: proper links to appropriate diffs when ddiffs=1 and proper link/content for log entry related to new page.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5838
diff changeset
263
5848
468e63254a4a action/rss_rc.py: forcing unicode for comment strings.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5847
diff changeset
264 comment = _(u"Upload of attachment '%(filename)s'.") % {
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
265 'filename': filename}
5839
d415cb95645c action/rss_rc.py: proper links to appropriate diffs when ddiffs=1 and proper link/content for log entry related to new page.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5838
diff changeset
266
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
267 elif action == 'ATTDEL':
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
268 if ddiffs:
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
269 handler.simpleNode('link', full_url(request, page,
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
270 querystr={'action': 'AttachFile'}))
5839
d415cb95645c action/rss_rc.py: proper links to appropriate diffs when ddiffs=1 and proper link/content for log entry related to new page.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5838
diff changeset
271
5848
468e63254a4a action/rss_rc.py: forcing unicode for comment strings.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5847
diff changeset
272 comment = _(u"Attachment '%(filename)s' deleted.") % {
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
273 'filename': filename}
5839
d415cb95645c action/rss_rc.py: proper links to appropriate diffs when ddiffs=1 and proper link/content for log entry related to new page.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5838
diff changeset
274
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
275 elif action == 'ATTDRW':
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
276 if ddiffs:
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
277 handler.simpleNode('link', attach_url(request,
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
278 cur_pagename, filename, do='view'))
5839
d415cb95645c action/rss_rc.py: proper links to appropriate diffs when ddiffs=1 and proper link/content for log entry related to new page.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5838
diff changeset
279
5848
468e63254a4a action/rss_rc.py: forcing unicode for comment strings.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5847
diff changeset
280 comment = _(u"Drawing '%(filename)s' saved.") % {
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
281 'filename': filename}
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
282
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
283 elif action.startswith('SAVE'):
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
284 if action == 'SAVE/REVERT':
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
285 to_rev = int(item.extra)
5848
468e63254a4a action/rss_rc.py: forcing unicode for comment strings.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5847
diff changeset
286 comment = (_(u"Revert to revision %(rev)d.") % {
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
287 'rev': to_rev}) + "<br />" \
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
288 + _("Comment:") + " " + comment
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
289
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
290 elif action == 'SAVE/RENAME':
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
291 show_diff = 0
5848
468e63254a4a action/rss_rc.py: forcing unicode for comment strings.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5847
diff changeset
292 comment = (_(u"Renamed from '%(oldpagename)s'.") % {
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
293 'oldpagename': item.extra}) + "<br />" \
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
294 + _("Comment:") + " " + comment
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
295 if item.pagename in pagename_map:
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
296 newpage = pagename_map[item.pagename]
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
297 del pagename_map[item.pagename]
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
298 pagename_map[item.extra] = newpage
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
299 else:
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
300 pagename_map[item.extra] = item.pagename
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
301
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
302 elif action == 'SAVENEW':
5848
468e63254a4a action/rss_rc.py: forcing unicode for comment strings.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5847
diff changeset
303 comment = _(u"New page:\n") + comment
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
304
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
305 item_rev = int(item.rev)
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
306
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
307 # If we use diffs/ddiffs, we should calculate proper links and
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
308 # content
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
309 if ddiffs:
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
310 # first revision can't have older revisions to diff with
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
311 if item_rev == 1:
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
312 handler.simpleNode('link', full_url(request, page,
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
313 querystr={'action': 'recall',
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
314 'rev': str(item_rev)}))
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
315 else:
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
316 handler.simpleNode('link', full_url(request, page,
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
317 querystr={'action': 'diff',
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
318 'rev1': str(item_rev),
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
319 'rev2': str(item_rev - 1)}))
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
320
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
321 if show_diff:
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
322 if item_rev == 1:
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
323 lines = Page(request, cur_pagename,
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
324 rev=item_rev).getlines()
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
325 else:
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
326 lines = wikiutil.pagediff(request, cur_pagename,
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
327 item_rev - 1, cur_pagename, item_rev, ignorews=1)
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
328
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
329 if len(lines) > max_lines:
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
330 lines = lines[:max_lines] + ['...\n']
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
331
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
332 lines = '\n'.join(lines)
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
333 lines = wikiutil.escape(lines)
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
334
5848
468e63254a4a action/rss_rc.py: forcing unicode for comment strings.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5847
diff changeset
335 comment = u'%s\n<pre>\n%s\n</pre>\n' % (comment, lines)
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
336
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
337 if not ddiffs:
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5843
diff changeset
338 handler.simpleNode('link', full_url(request, page))
5839
d415cb95645c action/rss_rc.py: proper links to appropriate diffs when ddiffs=1 and proper link/content for log entry related to new page.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5838
diff changeset
339
5843
89fbca5396a1 action/rss_rc.py: proper support of rename, revert, page creation.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5842
diff changeset
340 if comment:
89fbca5396a1 action/rss_rc.py: proper support of rename, revert, page creation.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5842
diff changeset
341 handler.simpleNode('description', comment)
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
342
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
343 # contributor
5842
97e36f417f6e action/rss_rc.py: preserving show_names configuration option.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
344 if cfg.show_names:
97e36f417f6e action/rss_rc.py: preserving show_names configuration option.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
345 edattr = {}
97e36f417f6e action/rss_rc.py: preserving show_names configuration option.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
346 if cfg.show_hosts:
97e36f417f6e action/rss_rc.py: preserving show_names configuration option.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
347 edattr[(handler.xmlns['wiki'], 'host')] = item.hostname
97e36f417f6e action/rss_rc.py: preserving show_names configuration option.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
348 if item.editor[0] == 'interwiki':
97e36f417f6e action/rss_rc.py: preserving show_names configuration option.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
349 edname = "%s:%s" % item.editor[1]
97e36f417f6e action/rss_rc.py: preserving show_names configuration option.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
350 ##edattr[(None, 'link')] = baseurl + wikiutil.quoteWikiname(edname)
97e36f417f6e action/rss_rc.py: preserving show_names configuration option.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
351 else: # 'ip'
97e36f417f6e action/rss_rc.py: preserving show_names configuration option.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
352 edname = item.editor[1]
97e36f417f6e action/rss_rc.py: preserving show_names configuration option.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
353 ##edattr[(None, 'link')] = link + "?action=info"
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
354
5842
97e36f417f6e action/rss_rc.py: preserving show_names configuration option.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
355 # this edattr stuff, esp. None as first tuple element breaks things (tracebacks)
97e36f417f6e action/rss_rc.py: preserving show_names configuration option.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
356 # if you know how to do this right, please send us a patch
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
357
5842
97e36f417f6e action/rss_rc.py: preserving show_names configuration option.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
358 handler.startNode(('dc', 'contributor'))
97e36f417f6e action/rss_rc.py: preserving show_names configuration option.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
359 handler.startNode(('rdf', 'Description'), attr=edattr)
97e36f417f6e action/rss_rc.py: preserving show_names configuration option.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
360 handler.simpleNode(('rdf', 'value'), edname)
97e36f417f6e action/rss_rc.py: preserving show_names configuration option.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
361 handler.endNode(('rdf', 'Description'))
97e36f417f6e action/rss_rc.py: preserving show_names configuration option.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
362 handler.endNode(('dc', 'contributor'))
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
363
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
364 # wiki extensions
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
365 handler.simpleNode(('wiki', 'version'), "%i" % (item.ed_time_usecs))
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
366 handler.simpleNode(('wiki', 'status'), ('deleted', 'updated')[page.exists()])
1665
c57f72b49ea2 cleanup rss_rc action, use page.url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1184
diff changeset
367 handler.simpleNode(('wiki', 'diff'), full_url(request, page, querystr={'action': 'diff'}))
c57f72b49ea2 cleanup rss_rc action, use page.url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1184
diff changeset
368 handler.simpleNode(('wiki', 'history'), full_url(request, page, querystr={'action': 'info'}))
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
369 # handler.simpleNode(('wiki', 'importance'), ) # ( major | minor )
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
370 # handler.simpleNode(('wiki', 'version'), ) # ( #PCDATA )
1113
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
371
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
372 handler.endNode('item')
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
373
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
374 # end SAX stream
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
375 handler.endDocument()
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
376
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
377 request.write(out.getvalue())
9485500daadf read if-modified-since and if-none-match headers, first use for rss_rc action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1068
diff changeset
378