##// END OF EJS Templates
Implemented #661 Add option to include diff in RSS feed...
marcink -
r3028:30a22640 beta
parent child Browse files
Show More
@@ -65,6 +65,13 b' force_https = false'
65 commit_parse_limit = 25
65 commit_parse_limit = 25
66 use_gravatar = true
66 use_gravatar = true
67
67
68 ## RSS feed options
69
70 rss_cut_off_limit = 256000
71 rss_items_per_page = 10
72 rss_include_diff = false
73
74
68 ## alternative_gravatar_url allows you to use your own avatar server application
75 ## alternative_gravatar_url allows you to use your own avatar server application
69 ## the following parts of the URL will be replaced
76 ## the following parts of the URL will be replaced
70 ## {email} user email
77 ## {email} user email
@@ -65,6 +65,13 b' force_https = false'
65 commit_parse_limit = 50
65 commit_parse_limit = 50
66 use_gravatar = true
66 use_gravatar = true
67
67
68 ## RSS feed options
69
70 rss_cut_off_limit = 256000
71 rss_items_per_page = 10
72 rss_include_diff = false
73
74
68 ## alternative_gravatar_url allows you to use your own avatar server application
75 ## alternative_gravatar_url allows you to use your own avatar server application
69 ## the following parts of the URL will be replaced
76 ## the following parts of the URL will be replaced
70 ## {email} user email
77 ## {email} user email
@@ -65,6 +65,13 b' force_https = false'
65 commit_parse_limit = 50
65 commit_parse_limit = 50
66 use_gravatar = true
66 use_gravatar = true
67
67
68 ## RSS feed options
69
70 rss_cut_off_limit = 256000
71 rss_items_per_page = 10
72 rss_include_diff = false
73
74
68 ## alternative_gravatar_url allows you to use your own avatar server application
75 ## alternative_gravatar_url allows you to use your own avatar server application
69 ## the following parts of the URL will be replaced
76 ## the following parts of the URL will be replaced
70 ## {email} user email
77 ## {email} user email
@@ -36,6 +36,7 b' from rhodecode.lib.auth import LoginRequ'
36 from rhodecode.lib.base import BaseRepoController
36 from rhodecode.lib.base import BaseRepoController
37 from rhodecode.lib.diffs import DiffProcessor, LimitedDiffContainer
37 from rhodecode.lib.diffs import DiffProcessor, LimitedDiffContainer
38 from rhodecode.model.db import CacheInvalidation
38 from rhodecode.model.db import CacheInvalidation
39 from rhodecode.lib.utils2 import safe_int, str2bool
39
40
40 log = logging.getLogger(__name__)
41 log = logging.getLogger(__name__)
41
42
@@ -52,10 +53,13 b' class FeedController(BaseRepoController)'
52 self.title = self.title = _('%s %s feed') % (c.rhodecode_name, '%s')
53 self.title = self.title = _('%s %s feed') % (c.rhodecode_name, '%s')
53 self.language = 'en-us'
54 self.language = 'en-us'
54 self.ttl = "5"
55 self.ttl = "5"
55 self.feed_nr = 20
56 import rhodecode
57 CONF = rhodecode.CONFIG
58 self.include_diff = str2bool(CONF.get('rss_include_diff', False))
59 self.feed_nr = safe_int(CONF.get('rss_items_per_page', 20))
56 # we need to protect from parsing huge diffs here other way
60 # we need to protect from parsing huge diffs here other way
57 # we can kill the server, 32*1024 chars is a reasonable limit
61 # we can kill the server
58 self.feed_diff_limit = 32 * 1024
62 self.feed_diff_limit = safe_int(CONF.get('rss_cut_off_limit'), 32 * 1024)
59
63
60 def _get_title(self, cs):
64 def _get_title(self, cs):
61 return "%s" % (
65 return "%s" % (
@@ -80,7 +84,7 b' class FeedController(BaseRepoController)'
80 if limited_diff:
84 if limited_diff:
81 changes = changes + ['\n ' +
85 changes = changes + ['\n ' +
82 _('Changeset was too big and was cut off...')]
86 _('Changeset was too big and was cut off...')]
83 return changes
87 return diff_processor, changes
84
88
85 def __get_desc(self, cs):
89 def __get_desc(self, cs):
86 desc_msg = []
90 desc_msg = []
@@ -95,6 +99,7 b' class FeedController(BaseRepoController)'
95 desc_msg.append('bookmark: %s<br/>' % book)
99 desc_msg.append('bookmark: %s<br/>' % book)
96 for tag in cs.tags:
100 for tag in cs.tags:
97 desc_msg.append('tag: %s<br/>' % tag)
101 desc_msg.append('tag: %s<br/>' % tag)
102 diff_processor, changes = self.__changes(cs)
98 # rev link
103 # rev link
99 _url = url('changeset_home', repo_name=cs.repository.name,
104 _url = url('changeset_home', repo_name=cs.repository.name,
100 revision=cs.raw_id, qualified=True)
105 revision=cs.raw_id, qualified=True)
@@ -103,7 +108,10 b' class FeedController(BaseRepoController)'
103 desc_msg.append('<pre>')
108 desc_msg.append('<pre>')
104 desc_msg.append(cs.message)
109 desc_msg.append(cs.message)
105 desc_msg.append('\n')
110 desc_msg.append('\n')
106 desc_msg.extend(self.__changes(cs))
111 desc_msg.extend(changes)
112 if self.include_diff:
113 desc_msg.append('\n\n')
114 desc_msg.append(diff_processor.as_raw())
107 desc_msg.append('</pre>')
115 desc_msg.append('</pre>')
108 return desc_msg
116 return desc_msg
109
117
General Comments 0
You need to be logged in to leave comments. Login now