Mercurial > kallithea
annotate rhodecode/controllers/feed.py @ 2980:234435584a0d beta
implements #632,
- added branch/tag/bookmarks info into feeds
- added changeset link to body of message
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 04 Nov 2012 13:43:21 +0100 |
parents | a93c07ade43a |
children | 023f7873ef59 |
rev | line source |
---|---|
861
fd2ea6ceadc8
updated docs on every controller
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
1 # -*- coding: utf-8 -*- |
fd2ea6ceadc8
updated docs on every controller
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
2 """ |
fd2ea6ceadc8
updated docs on every controller
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
3 rhodecode.controllers.feed |
fd2ea6ceadc8
updated docs on every controller
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
fd2ea6ceadc8
updated docs on every controller
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
5 |
fd2ea6ceadc8
updated docs on every controller
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
6 Feed controller for rhodecode |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1162
diff
changeset
|
7 |
861
fd2ea6ceadc8
updated docs on every controller
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
8 :created_on: Apr 23, 2010 |
fd2ea6ceadc8
updated docs on every controller
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
9 :author: marcink |
1824
89efedac4e6c
2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents:
1359
diff
changeset
|
10 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com> |
861
fd2ea6ceadc8
updated docs on every controller
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
11 :license: GPLv3, see COPYING for more details. |
fd2ea6ceadc8
updated docs on every controller
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
12 """ |
1206
a671db5bdd58
fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
13 # This program is free software: you can redistribute it and/or modify |
a671db5bdd58
fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
14 # it under the terms of the GNU General Public License as published by |
a671db5bdd58
fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
15 # the Free Software Foundation, either version 3 of the License, or |
a671db5bdd58
fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
16 # (at your option) any later version. |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1162
diff
changeset
|
17 # |
252
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
18 # This program is distributed in the hope that it will be useful, |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
21 # GNU General Public License for more details. |
1203
6832ef664673
source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents:
1162
diff
changeset
|
22 # |
252
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
245
diff
changeset
|
23 # You should have received a copy of the GNU General Public License |
1206
a671db5bdd58
fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1203
diff
changeset
|
24 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
861
fd2ea6ceadc8
updated docs on every controller
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
25 |
fd2ea6ceadc8
updated docs on every controller
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
26 import logging |
fd2ea6ceadc8
updated docs on every controller
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
27 |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1038
diff
changeset
|
28 from pylons import url, response, tmpl_context as c |
1038
5554aa9c2480
another major code rafactor, reimplemented (almost from scratch)
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
29 from pylons.i18n.translation import _ |
862
4bdd0bf1b1f4
security bugfix: protected feeds, from unauthorized access, even without this, the feeds would crash and were unreadable, But proper way of securing it is with the secure decarators.
Marcin Kuzminski <marcin@python-works.com>
parents:
861
diff
changeset
|
30 |
2385
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
31 from webhelpers.feedgenerator import Atom1Feed, Rss201rev2Feed |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
32 |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
33 from rhodecode.lib import helpers as h |
862
4bdd0bf1b1f4
security bugfix: protected feeds, from unauthorized access, even without this, the feeds would crash and were unreadable, But proper way of securing it is with the secure decarators.
Marcin Kuzminski <marcin@python-works.com>
parents:
861
diff
changeset
|
34 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1038
diff
changeset
|
35 from rhodecode.lib.base import BaseRepoController |
2385
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
36 from rhodecode.lib.diffs import DiffProcessor |
861
fd2ea6ceadc8
updated docs on every controller
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
37 |
205
66b20f525750
Added feed controllers, urls,and changed index page to use them.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
38 log = logging.getLogger(__name__) |
66b20f525750
Added feed controllers, urls,and changed index page to use them.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
39 |
1212 | 40 |
1045
3fc9183e05dd
another major codes rewrite:
Marcin Kuzminski <marcin@python-works.com>
parents:
1038
diff
changeset
|
41 class FeedController(BaseRepoController): |
861
fd2ea6ceadc8
updated docs on every controller
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
42 |
1120
a8d759613d8f
fixed some bugs in api key auth, added access by api key into rss/atom feeds in global journal
Marcin Kuzminski <marcin@python-works.com>
parents:
1088
diff
changeset
|
43 @LoginRequired(api_access=True) |
862
4bdd0bf1b1f4
security bugfix: protected feeds, from unauthorized access, even without this, the feeds would crash and were unreadable, But proper way of securing it is with the secure decarators.
Marcin Kuzminski <marcin@python-works.com>
parents:
861
diff
changeset
|
44 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
4bdd0bf1b1f4
security bugfix: protected feeds, from unauthorized access, even without this, the feeds would crash and were unreadable, But proper way of securing it is with the secure decarators.
Marcin Kuzminski <marcin@python-works.com>
parents:
861
diff
changeset
|
45 'repository.admin') |
205
66b20f525750
Added feed controllers, urls,and changed index page to use them.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
46 def __before__(self): |
66b20f525750
Added feed controllers, urls,and changed index page to use them.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
47 super(FeedController, self).__before__() |
207
8bdec09436cb
bumped version to 0.7.1 added atom and rss feeds. Moved https Fixud middleware before error middleware to proper generate debug page (static imports)
Marcin Kuzminski <marcin@python-works.com>
parents:
205
diff
changeset
|
48 #common values for feeds |
1038
5554aa9c2480
another major code rafactor, reimplemented (almost from scratch)
Marcin Kuzminski <marcin@python-works.com>
parents:
902
diff
changeset
|
49 self.description = _('Changes on %s repository') |
1088
fee472613dfa
made simple global rss and atom feed
Marcin Kuzminski <marcin@python-works.com>
parents:
1045
diff
changeset
|
50 self.title = self.title = _('%s %s feed') % (c.rhodecode_name, '%s') |
207
8bdec09436cb
bumped version to 0.7.1 added atom and rss feeds. Moved https Fixud middleware before error middleware to proper generate debug page (static imports)
Marcin Kuzminski <marcin@python-works.com>
parents:
205
diff
changeset
|
51 self.language = 'en-us' |
8bdec09436cb
bumped version to 0.7.1 added atom and rss feeds. Moved https Fixud middleware before error middleware to proper generate debug page (static imports)
Marcin Kuzminski <marcin@python-works.com>
parents:
205
diff
changeset
|
52 self.ttl = "5" |
2385
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
53 self.feed_nr = 20 |
207
8bdec09436cb
bumped version to 0.7.1 added atom and rss feeds. Moved https Fixud middleware before error middleware to proper generate debug page (static imports)
Marcin Kuzminski <marcin@python-works.com>
parents:
205
diff
changeset
|
54 |
1897
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
55 def _get_title(self, cs): |
2385
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
56 return "%s" % ( |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
57 h.shorter(cs.message, 160) |
1897
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
58 ) |
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
59 |
1162
76c5b69c1b27
fixed wrong order of changes in feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
1120
diff
changeset
|
60 def __changes(self, cs): |
1359
54fc83f2192c
Removed all string concat for exchange of ''.join()
Marcin Kuzminski <marcin@python-works.com>
parents:
1295
diff
changeset
|
61 changes = [] |
2783
a93c07ade43a
Added huge diff protection for RSS/ATOM feeds.
Marcin Kuzminski <marcin@python-works.com>
parents:
2419
diff
changeset
|
62 _diff = cs.diff() |
a93c07ade43a
Added huge diff protection for RSS/ATOM feeds.
Marcin Kuzminski <marcin@python-works.com>
parents:
2419
diff
changeset
|
63 # we need to protect from parsing huge diffs here other way |
a93c07ade43a
Added huge diff protection for RSS/ATOM feeds.
Marcin Kuzminski <marcin@python-works.com>
parents:
2419
diff
changeset
|
64 # we can kill the server, 32*1024 chars is a reasonable limit |
a93c07ade43a
Added huge diff protection for RSS/ATOM feeds.
Marcin Kuzminski <marcin@python-works.com>
parents:
2419
diff
changeset
|
65 HUGE_DIFF = 32 * 1024 |
a93c07ade43a
Added huge diff protection for RSS/ATOM feeds.
Marcin Kuzminski <marcin@python-works.com>
parents:
2419
diff
changeset
|
66 if len(_diff) > HUGE_DIFF: |
a93c07ade43a
Added huge diff protection for RSS/ATOM feeds.
Marcin Kuzminski <marcin@python-works.com>
parents:
2419
diff
changeset
|
67 changes = ['\n ' + _('Changeset was too big and was cut off...')] |
a93c07ade43a
Added huge diff protection for RSS/ATOM feeds.
Marcin Kuzminski <marcin@python-works.com>
parents:
2419
diff
changeset
|
68 return changes |
a93c07ade43a
Added huge diff protection for RSS/ATOM feeds.
Marcin Kuzminski <marcin@python-works.com>
parents:
2419
diff
changeset
|
69 diffprocessor = DiffProcessor(_diff) |
2385
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
70 stats = diffprocessor.prepare(inline_diff=False) |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
71 for st in stats: |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
72 st.update({'added': st['stats'][0], |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
73 'removed': st['stats'][1]}) |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
74 changes.append('\n %(operation)s %(filename)s ' |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
75 '(%(added)s lines added, %(removed)s lines removed)' |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
76 % st) |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
77 return changes |
1162
76c5b69c1b27
fixed wrong order of changes in feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
1120
diff
changeset
|
78 |
2385
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
79 def __get_desc(self, cs): |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
80 desc_msg = [] |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
81 desc_msg.append('%s %s %s:<br/>' % (cs.author, _('commited on'), |
2419
513de5ffe608
Also use the date formatter on the feeds.
Vincent Duvert <vincent@duvert.net>
parents:
2385
diff
changeset
|
82 h.fmt_date(cs.date))) |
2980
234435584a0d
implements #632,
Marcin Kuzminski <marcin@python-works.com>
parents:
2783
diff
changeset
|
83 #branches, tags, bookmarks |
234435584a0d
implements #632,
Marcin Kuzminski <marcin@python-works.com>
parents:
2783
diff
changeset
|
84 if cs.branch: |
234435584a0d
implements #632,
Marcin Kuzminski <marcin@python-works.com>
parents:
2783
diff
changeset
|
85 desc_msg.append('branch: %s<br/>' % cs.branch) |
234435584a0d
implements #632,
Marcin Kuzminski <marcin@python-works.com>
parents:
2783
diff
changeset
|
86 if h.is_hg(c.rhodecode_repo): |
234435584a0d
implements #632,
Marcin Kuzminski <marcin@python-works.com>
parents:
2783
diff
changeset
|
87 for book in cs.bookmarks: |
234435584a0d
implements #632,
Marcin Kuzminski <marcin@python-works.com>
parents:
2783
diff
changeset
|
88 desc_msg.append('bookmark: %s<br/>' % book) |
234435584a0d
implements #632,
Marcin Kuzminski <marcin@python-works.com>
parents:
2783
diff
changeset
|
89 for tag in cs.tags: |
234435584a0d
implements #632,
Marcin Kuzminski <marcin@python-works.com>
parents:
2783
diff
changeset
|
90 desc_msg.append('tag: %s<br/>' % tag) |
234435584a0d
implements #632,
Marcin Kuzminski <marcin@python-works.com>
parents:
2783
diff
changeset
|
91 # rev link |
234435584a0d
implements #632,
Marcin Kuzminski <marcin@python-works.com>
parents:
2783
diff
changeset
|
92 _url = url('changeset_home', repo_name=cs.repository.name, |
234435584a0d
implements #632,
Marcin Kuzminski <marcin@python-works.com>
parents:
2783
diff
changeset
|
93 revision=cs.raw_id, qualified=True) |
234435584a0d
implements #632,
Marcin Kuzminski <marcin@python-works.com>
parents:
2783
diff
changeset
|
94 desc_msg.append('changesest: <a href="%s">%s</a>' % (_url, cs.raw_id[:8])) |
234435584a0d
implements #632,
Marcin Kuzminski <marcin@python-works.com>
parents:
2783
diff
changeset
|
95 |
2385
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
96 desc_msg.append('<pre>') |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
97 desc_msg.append(cs.message) |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
98 desc_msg.append('\n') |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
99 desc_msg.extend(self.__changes(cs)) |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
100 desc_msg.append('</pre>') |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
101 return desc_msg |
1162
76c5b69c1b27
fixed wrong order of changes in feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
1120
diff
changeset
|
102 |
207
8bdec09436cb
bumped version to 0.7.1 added atom and rss feeds. Moved https Fixud middleware before error middleware to proper generate debug page (static imports)
Marcin Kuzminski <marcin@python-works.com>
parents:
205
diff
changeset
|
103 def atom(self, repo_name): |
8bdec09436cb
bumped version to 0.7.1 added atom and rss feeds. Moved https Fixud middleware before error middleware to proper generate debug page (static imports)
Marcin Kuzminski <marcin@python-works.com>
parents:
205
diff
changeset
|
104 """Produce an atom-1.0 feed via feedgenerator module""" |
1897
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
105 feed = Atom1Feed( |
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
106 title=self.title % repo_name, |
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
107 link=url('summary_home', repo_name=repo_name, |
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
108 qualified=True), |
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
109 description=self.description % repo_name, |
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
110 language=self.language, |
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
111 ttl=self.ttl |
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
112 ) |
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
113 |
1162
76c5b69c1b27
fixed wrong order of changes in feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
1120
diff
changeset
|
114 for cs in reversed(list(c.rhodecode_repo[-self.feed_nr:])): |
1897
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
115 feed.add_item(title=self._get_title(cs), |
245
a83a1799480c
Reimplemented way of caching repos list, hg model now get's repos objects right from cached dict, this way we skipp creating instances of MercurialRepository and gain performance. Some import cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
207
diff
changeset
|
116 link=url('changeset_home', repo_name=repo_name, |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
117 revision=cs.raw_id, qualified=True), |
1162
76c5b69c1b27
fixed wrong order of changes in feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
1120
diff
changeset
|
118 author_name=cs.author, |
2385
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
119 description=''.join(self.__get_desc(cs)), |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
120 pubdate=cs.date, |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
121 ) |
861
fd2ea6ceadc8
updated docs on every controller
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
122 |
207
8bdec09436cb
bumped version to 0.7.1 added atom and rss feeds. Moved https Fixud middleware before error middleware to proper generate debug page (static imports)
Marcin Kuzminski <marcin@python-works.com>
parents:
205
diff
changeset
|
123 response.content_type = feed.mime_type |
8bdec09436cb
bumped version to 0.7.1 added atom and rss feeds. Moved https Fixud middleware before error middleware to proper generate debug page (static imports)
Marcin Kuzminski <marcin@python-works.com>
parents:
205
diff
changeset
|
124 return feed.writeString('utf-8') |
8bdec09436cb
bumped version to 0.7.1 added atom and rss feeds. Moved https Fixud middleware before error middleware to proper generate debug page (static imports)
Marcin Kuzminski <marcin@python-works.com>
parents:
205
diff
changeset
|
125 |
8bdec09436cb
bumped version to 0.7.1 added atom and rss feeds. Moved https Fixud middleware before error middleware to proper generate debug page (static imports)
Marcin Kuzminski <marcin@python-works.com>
parents:
205
diff
changeset
|
126 def rss(self, repo_name): |
8bdec09436cb
bumped version to 0.7.1 added atom and rss feeds. Moved https Fixud middleware before error middleware to proper generate debug page (static imports)
Marcin Kuzminski <marcin@python-works.com>
parents:
205
diff
changeset
|
127 """Produce an rss2 feed via feedgenerator module""" |
1897
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
128 feed = Rss201rev2Feed( |
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
129 title=self.title % repo_name, |
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
130 link=url('summary_home', repo_name=repo_name, |
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
131 qualified=True), |
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
132 description=self.description % repo_name, |
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
133 language=self.language, |
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
134 ttl=self.ttl |
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
135 ) |
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
136 |
1162
76c5b69c1b27
fixed wrong order of changes in feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
1120
diff
changeset
|
137 for cs in reversed(list(c.rhodecode_repo[-self.feed_nr:])): |
1897
0f22dedb588f
added short_id to feeds, and made it more compact
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
138 feed.add_item(title=self._get_title(cs), |
507
f420e86db893
drastic speed improvment in feed generation (was using old method)
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
139 link=url('changeset_home', repo_name=repo_name, |
636
ffd07396d315
Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents:
629
diff
changeset
|
140 revision=cs.raw_id, qualified=True), |
1162
76c5b69c1b27
fixed wrong order of changes in feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
1120
diff
changeset
|
141 author_name=cs.author, |
2385
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
142 description=''.join(self.__get_desc(cs)), |
a455b2c79c85
Improved RSS/ATOM feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
2109
diff
changeset
|
143 pubdate=cs.date, |
1162
76c5b69c1b27
fixed wrong order of changes in feeds
Marcin Kuzminski <marcin@python-works.com>
parents:
1120
diff
changeset
|
144 ) |
861
fd2ea6ceadc8
updated docs on every controller
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
145 |
207
8bdec09436cb
bumped version to 0.7.1 added atom and rss feeds. Moved https Fixud middleware before error middleware to proper generate debug page (static imports)
Marcin Kuzminski <marcin@python-works.com>
parents:
205
diff
changeset
|
146 response.content_type = feed.mime_type |
8bdec09436cb
bumped version to 0.7.1 added atom and rss feeds. Moved https Fixud middleware before error middleware to proper generate debug page (static imports)
Marcin Kuzminski <marcin@python-works.com>
parents:
205
diff
changeset
|
147 return feed.writeString('utf-8') |