##// END OF EJS Templates
pep8ify
marcink -
r1212:50e41777 beta
parent child Browse files
Show More
@@ -33,6 +33,7 b' from rhodecode.lib.utils import OrderedD'
33
33
34 log = logging.getLogger(__name__)
34 log = logging.getLogger(__name__)
35
35
36
36 class BranchesController(BaseRepoController):
37 class BranchesController(BaseRepoController):
37
38
38 @LoginRequired()
39 @LoginRequired()
@@ -40,6 +40,7 b' from rhodecode.lib.helpers import RepoPa'
40
40
41 log = logging.getLogger(__name__)
41 log = logging.getLogger(__name__)
42
42
43
43 class ChangelogController(BaseRepoController):
44 class ChangelogController(BaseRepoController):
44
45
45 @LoginRequired()
46 @LoginRequired()
@@ -67,14 +68,14 b' class ChangelogController(BaseRepoContro'
67 p = int(request.params.get('page', 1))
68 p = int(request.params.get('page', 1))
68 branch_name = request.params.get('branch', None)
69 branch_name = request.params.get('branch', None)
69 c.total_cs = len(c.rhodecode_repo)
70 c.total_cs = len(c.rhodecode_repo)
70 c.pagination = RepoPage(c.rhodecode_repo, page=p, item_count=c.total_cs,
71 c.pagination = RepoPage(c.rhodecode_repo, page=p,
71 items_per_page=c.size, branch_name=branch_name)
72 item_count=c.total_cs, items_per_page=c.size,
73 branch_name=branch_name)
72
74
73 self._graph(c.rhodecode_repo, c.total_cs, c.size, p)
75 self._graph(c.rhodecode_repo, c.total_cs, c.size, p)
74
76
75 return render('changelog/changelog.html')
77 return render('changelog/changelog.html')
76
78
77
78 def _graph(self, repo, repo_size, size, p):
79 def _graph(self, repo, repo_size, size, p):
79 """
80 """
80 Generates a DAG graph for mercurial
81 Generates a DAG graph for mercurial
@@ -43,6 +43,7 b' from vcs.utils.ordered_dict import Order'
43
43
44 log = logging.getLogger(__name__)
44 log = logging.getLogger(__name__)
45
45
46
46 class ChangesetController(BaseRepoController):
47 class ChangesetController(BaseRepoController):
47
48
48 @LoginRequired()
49 @LoginRequired()
@@ -94,7 +95,6 b' class ChangesetController(BaseRepoContro'
94 except IndexError:
95 except IndexError:
95 changeset_parent = None
96 changeset_parent = None
96
97
97
98 #==================================================================
98 #==================================================================
99 # ADDED FILES
99 # ADDED FILES
100 #==================================================================
100 #==================================================================
@@ -106,17 +106,20 b' class ChangesetController(BaseRepoContro'
106 c.sum_added += node.size
106 c.sum_added += node.size
107 if c.sum_added < self.cut_off_limit:
107 if c.sum_added < self.cut_off_limit:
108 f_gitdiff = differ.get_gitdiff(filenode_old, node)
108 f_gitdiff = differ.get_gitdiff(filenode_old, node)
109 diff = differ.DiffProcessor(f_gitdiff, format='gitdiff').as_html()
109 diff = differ.DiffProcessor(f_gitdiff,
110 format='gitdiff').as_html()
110
111
111 else:
112 else:
112 diff = wrap_to_table(_('Changeset is to big and was cut'
113 diff = wrap_to_table(_('Changeset is to big and '
113 ' off, see raw changeset instead'))
114 'was cut off, see raw '
115 'changeset instead'))
114 c.cut_off = True
116 c.cut_off = True
115 break
117 break
116
118
117 cs1 = None
119 cs1 = None
118 cs2 = node.last_changeset.raw_id
120 cs2 = node.last_changeset.raw_id
119 c.changes[changeset.raw_id].append(('added', node, diff, cs1, cs2))
121 c.changes[changeset.raw_id].append(('added', node,
122 diff, cs1, cs2))
120
123
121 #==================================================================
124 #==================================================================
122 # CHANGED FILES
125 # CHANGED FILES
@@ -126,7 +129,8 b' class ChangesetController(BaseRepoContro'
126 try:
129 try:
127 filenode_old = changeset_parent.get_node(node.path)
130 filenode_old = changeset_parent.get_node(node.path)
128 except ChangesetError:
131 except ChangesetError:
129 filenode_old = FileNode(node.path, '', EmptyChangeset())
132 filenode_old = FileNode(node.path, '',
133 EmptyChangeset())
130
134
131 if filenode_old.is_binary or node.is_binary:
135 if filenode_old.is_binary or node.is_binary:
132 diff = wrap_to_table(_('binary file'))
136 diff = wrap_to_table(_('binary file'))
@@ -134,25 +138,30 b' class ChangesetController(BaseRepoContro'
134
138
135 if c.sum_removed < self.cut_off_limit:
139 if c.sum_removed < self.cut_off_limit:
136 f_gitdiff = differ.get_gitdiff(filenode_old, node)
140 f_gitdiff = differ.get_gitdiff(filenode_old, node)
137 diff = differ.DiffProcessor(f_gitdiff, format='gitdiff').as_html()
141 diff = differ.DiffProcessor(f_gitdiff,
142 format='gitdiff')\
143 .as_html()
138 if diff:
144 if diff:
139 c.sum_removed += len(diff)
145 c.sum_removed += len(diff)
140 else:
146 else:
141 diff = wrap_to_table(_('Changeset is to big and was cut'
147 diff = wrap_to_table(_('Changeset is to big and '
142 ' off, see raw changeset instead'))
148 'was cut off, see raw '
149 'changeset instead'))
143 c.cut_off = True
150 c.cut_off = True
144 break
151 break
145
152
146 cs1 = filenode_old.last_changeset.raw_id
153 cs1 = filenode_old.last_changeset.raw_id
147 cs2 = node.last_changeset.raw_id
154 cs2 = node.last_changeset.raw_id
148 c.changes[changeset.raw_id].append(('changed', node, diff, cs1, cs2))
155 c.changes[changeset.raw_id].append(('changed', node,
156 diff, cs1, cs2))
149
157
150 #==================================================================
158 #==================================================================
151 # REMOVED FILES
159 # REMOVED FILES
152 #==================================================================
160 #==================================================================
153 if not c.cut_off:
161 if not c.cut_off:
154 for node in changeset.removed:
162 for node in changeset.removed:
155 c.changes[changeset.raw_id].append(('removed', node, None, None, None))
163 c.changes[changeset.raw_id].append(('removed', node, None,
164 None, None))
156
165
157 if len(c.cs_ranges) == 1:
166 if len(c.cs_ranges) == 1:
158 c.changeset = c.cs_ranges[0]
167 c.changeset = c.cs_ranges[0]
@@ -184,7 +193,8 b' class ChangesetController(BaseRepoContro'
184 diff = _('binary file') + '\n'
193 diff = _('binary file') + '\n'
185 else:
194 else:
186 f_gitdiff = differ.get_gitdiff(filenode_old, node)
195 f_gitdiff = differ.get_gitdiff(filenode_old, node)
187 diff = differ.DiffProcessor(f_gitdiff, format='gitdiff').raw_diff()
196 diff = differ.DiffProcessor(f_gitdiff,
197 format='gitdiff').raw_diff()
188
198
189 cs1 = None
199 cs1 = None
190 cs2 = node.last_changeset.raw_id
200 cs2 = node.last_changeset.raw_id
@@ -196,7 +206,8 b' class ChangesetController(BaseRepoContro'
196 diff = _('binary file')
206 diff = _('binary file')
197 else:
207 else:
198 f_gitdiff = differ.get_gitdiff(filenode_old, node)
208 f_gitdiff = differ.get_gitdiff(filenode_old, node)
199 diff = differ.DiffProcessor(f_gitdiff, format='gitdiff').raw_diff()
209 diff = differ.DiffProcessor(f_gitdiff,
210 format='gitdiff').raw_diff()
200
211
201 cs1 = filenode_old.last_changeset.raw_id
212 cs1 = filenode_old.last_changeset.raw_id
202 cs2 = node.last_changeset.raw_id
213 cs2 = node.last_changeset.raw_id
@@ -205,10 +216,12 b' class ChangesetController(BaseRepoContro'
205 response.content_type = 'text/plain'
216 response.content_type = 'text/plain'
206
217
207 if method == 'download':
218 if method == 'download':
208 response.content_disposition = 'attachment; filename=%s.patch' % revision
219 response.content_disposition = 'attachment; filename=%s.patch' \
220 % revision
209
221
210 parent = True if len(c.changeset.parents) > 0 else False
222 parent = True if len(c.changeset.parents) > 0 else False
211 c.parent_tmpl = 'Parent %s' % c.changeset.parents[0].raw_id if parent else ''
223 c.parent_tmpl = 'Parent %s' \
224 % c.changeset.parents[0].raw_id if parent else ''
212
225
213 c.diffs = ''
226 c.diffs = ''
214 for x in c.changes:
227 for x in c.changes:
@@ -27,7 +27,7 b' import cgi'
27 import logging
27 import logging
28 import paste.fileapp
28 import paste.fileapp
29
29
30 from pylons import tmpl_context as c, request, config
30 from pylons import tmpl_context as c, request, config, url
31 from pylons.i18n.translation import _
31 from pylons.i18n.translation import _
32 from pylons.middleware import media_path
32 from pylons.middleware import media_path
33
33
@@ -35,6 +35,7 b' from rhodecode.lib.base import BaseContr'
35
35
36 log = logging.getLogger(__name__)
36 log = logging.getLogger(__name__)
37
37
38
38 class ErrorController(BaseController):
39 class ErrorController(BaseController):
39 """Generates error documents as and when they are required.
40 """Generates error documents as and when they are required.
40
41
@@ -46,7 +47,8 b' class ErrorController(BaseController):'
46 """
47 """
47
48
48 def __before__(self):
49 def __before__(self):
49 pass#disable all base actions since we don't need them here
50 #disable all base actions since we don't need them here
51 pass
50
52
51 def document(self):
53 def document(self):
52 resp = request.environ.get('pylons.original_response')
54 resp = request.environ.get('pylons.original_response')
@@ -55,23 +57,20 b' class ErrorController(BaseController):'
55 log.debug('### %s ###', resp.status)
57 log.debug('### %s ###', resp.status)
56
58
57 e = request.environ
59 e = request.environ
58 c.serv_p = r'%(protocol)s://%(host)s/' % {
60 c.serv_p = r'%(protocol)s://%(host)s/' \
59 'protocol': e.get('wsgi.url_scheme'),
61 % {'protocol': e.get('wsgi.url_scheme'),
60 'host':e.get('HTTP_HOST'),
62 'host': e.get('HTTP_HOST'), }
61 }
62
63
63
64 c.error_message = cgi.escape(request.GET.get('code', str(resp.status)))
64 c.error_message = cgi.escape(request.GET.get('code', str(resp.status)))
65 c.error_explanation = self.get_error_explanation(resp.status_int)
65 c.error_explanation = self.get_error_explanation(resp.status_int)
66
66
67 #redirect to when error with given seconds
67 # redirect to when error with given seconds
68 c.redirect_time = 0
68 c.redirect_time = 0
69 c.redirect_module = _('Home page')# name to what your going to be redirected
69 c.redirect_module = _('Home page')
70 c.url_redirect = "/"
70 c.url_redirect = "/"
71
71
72 return render('/errors/error_document.html')
72 return render('/errors/error_document.html')
73
73
74
75 def img(self, id):
74 def img(self, id):
76 """Serve Pylons' stock images"""
75 """Serve Pylons' stock images"""
77 return self._serve_file(os.path.join(media_path, 'img', id))
76 return self._serve_file(os.path.join(media_path, 'img', id))
@@ -96,7 +95,8 b' class ErrorController(BaseController):'
96 code = 500
95 code = 500
97
96
98 if code == 400:
97 if code == 400:
99 return _('The request could not be understood by the server due to malformed syntax.')
98 return _('The request could not be understood by the server'
99 ' due to malformed syntax.')
100 if code == 401:
100 if code == 401:
101 return _('Unauthorized access to resource')
101 return _('Unauthorized access to resource')
102 if code == 403:
102 if code == 403:
@@ -104,4 +104,5 b' class ErrorController(BaseController):'
104 if code == 404:
104 if code == 404:
105 return _('The resource could not be found')
105 return _('The resource could not be found')
106 if code == 500:
106 if code == 500:
107 return _('The server encountered an unexpected condition which prevented it from fulfilling the request.')
107 return _('The server encountered an unexpected condition'
108 ' which prevented it from fulfilling the request.')
@@ -35,6 +35,7 b' from webhelpers.feedgenerator import Ato'
35
35
36 log = logging.getLogger(__name__)
36 log = logging.getLogger(__name__)
37
37
38
38 class FeedController(BaseRepoController):
39 class FeedController(BaseRepoController):
39
40
40 @LoginRequired(api_access=True)
41 @LoginRequired(api_access=True)
@@ -71,7 +72,8 b' class FeedController(BaseRepoController)'
71 def atom(self, repo_name):
72 def atom(self, repo_name):
72 """Produce an atom-1.0 feed via feedgenerator module"""
73 """Produce an atom-1.0 feed via feedgenerator module"""
73 feed = Atom1Feed(title=self.title % repo_name,
74 feed = Atom1Feed(title=self.title % repo_name,
74 link=url('summary_home', repo_name=repo_name, qualified=True),
75 link=url('summary_home', repo_name=repo_name,
76 qualified=True),
75 description=self.description % repo_name,
77 description=self.description % repo_name,
76 language=self.language,
78 language=self.language,
77 ttl=self.ttl)
79 ttl=self.ttl)
@@ -89,11 +91,11 b' class FeedController(BaseRepoController)'
89 response.content_type = feed.mime_type
91 response.content_type = feed.mime_type
90 return feed.writeString('utf-8')
92 return feed.writeString('utf-8')
91
93
92
93 def rss(self, repo_name):
94 def rss(self, repo_name):
94 """Produce an rss2 feed via feedgenerator module"""
95 """Produce an rss2 feed via feedgenerator module"""
95 feed = Rss201rev2Feed(title=self.title % repo_name,
96 feed = Rss201rev2Feed(title=self.title % repo_name,
96 link=url('summary_home', repo_name=repo_name, qualified=True),
97 link=url('summary_home', repo_name=repo_name,
98 qualified=True),
97 description=self.description % repo_name,
99 description=self.description % repo_name,
98 language=self.language,
100 language=self.language,
99 ttl=self.ttl)
101 ttl=self.ttl)
@@ -73,7 +73,6 b' class FilesController(BaseRepoController'
73 h.flash(str(e), category='warning')
73 h.flash(str(e), category='warning')
74 redirect(h.url('files_home', repo_name=repo_name, revision='tip'))
74 redirect(h.url('files_home', repo_name=repo_name, revision='tip'))
75
75
76
77 def __get_filenode_or_redirect(self, repo_name, cs, path):
76 def __get_filenode_or_redirect(self, repo_name, cs, path):
78 """
77 """
79 Returns file_node, if error occurs or given path is directory,
78 Returns file_node, if error occurs or given path is directory,
@@ -84,7 +83,6 b' class FilesController(BaseRepoController'
84 :param path: path to lookup
83 :param path: path to lookup
85 """
84 """
86
85
87
88 try:
86 try:
89 file_node = cs.get_node(path)
87 file_node = cs.get_node(path)
90 if file_node.is_dir():
88 if file_node.is_dir():
@@ -104,7 +102,6 b' class FilesController(BaseRepoController'
104 redirect(url('files_home', repo_name=c.repo_name,
102 redirect(url('files_home', repo_name=c.repo_name,
105 revision=cs.raw_id, f_path=f_path))
103 revision=cs.raw_id, f_path=f_path))
106
104
107
108 c.changeset = self.__get_cs_or_redirect(revision, repo_name)
105 c.changeset = self.__get_cs_or_redirect(revision, repo_name)
109 c.branch = request.GET.get('branch', None)
106 c.branch = request.GET.get('branch', None)
110 c.f_path = f_path
107 c.f_path = f_path
@@ -144,7 +141,6 b' class FilesController(BaseRepoController'
144 redirect(h.url('files_home', repo_name=repo_name,
141 redirect(h.url('files_home', repo_name=repo_name,
145 revision=revision))
142 revision=revision))
146
143
147
148 return render('files/files.html')
144 return render('files/files.html')
149
145
150 def rawfile(self, repo_name, revision, f_path):
146 def rawfile(self, repo_name, revision, f_path):
@@ -205,7 +201,6 b' class FilesController(BaseRepoController'
205
201
206 return cs.get_chunked_archive(stream=None, kind=fileformat)
202 return cs.get_chunked_archive(stream=None, kind=fileformat)
207
203
208
209 def diff(self, repo_name, f_path):
204 def diff(self, repo_name, f_path):
210 diff1 = request.GET.get('diff1')
205 diff1 = request.GET.get('diff1')
211 diff2 = request.GET.get('diff2')
206 diff2 = request.GET.get('diff2')
@@ -231,7 +226,6 b' class FilesController(BaseRepoController'
231 return redirect(url('files_home',
226 return redirect(url('files_home',
232 repo_name=c.repo_name, f_path=f_path))
227 repo_name=c.repo_name, f_path=f_path))
233
228
234
235 if c.action == 'download':
229 if c.action == 'download':
236 diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2),
230 diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2),
237 format='gitdiff')
231 format='gitdiff')
@@ -252,7 +246,8 b' class FilesController(BaseRepoController'
252
246
253 if node1.is_binary or node2.is_binary:
247 if node1.is_binary or node2.is_binary:
254 c.cur_diff = _('Binary file')
248 c.cur_diff = _('Binary file')
255 elif node1.size > self.cut_off_limit or node2.size > self.cut_off_limit:
249 elif node1.size > self.cut_off_limit or \
250 node2.size > self.cut_off_limit:
256 c.cur_diff = _('Diff is too big to display')
251 c.cur_diff = _('Diff is too big to display')
257 else:
252 else:
258 diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2),
253 diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2),
@@ -263,7 +258,8 b' class FilesController(BaseRepoController'
263 #default option
258 #default option
264 if node1.is_binary or node2.is_binary:
259 if node1.is_binary or node2.is_binary:
265 c.cur_diff = _('Binary file')
260 c.cur_diff = _('Binary file')
266 elif node1.size > self.cut_off_limit or node2.size > self.cut_off_limit:
261 elif node1.size > self.cut_off_limit or \
262 node2.size > self.cut_off_limit:
267 c.cur_diff = _('Diff is too big to display')
263 c.cur_diff = _('Diff is too big to display')
268 else:
264 else:
269 diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2),
265 diff = differ.DiffProcessor(differ.get_gitdiff(node1, node2),
@@ -35,6 +35,7 b' from rhodecode.lib.base import BaseContr'
35
35
36 log = logging.getLogger(__name__)
36 log = logging.getLogger(__name__)
37
37
38
38 class HomeController(BaseController):
39 class HomeController(BaseController):
39
40
40 @LoginRequired()
41 @LoginRequired()
@@ -41,10 +41,9 b' from rhodecode.model.db import UserLog, '
41
41
42 log = logging.getLogger(__name__)
42 log = logging.getLogger(__name__)
43
43
44
44 class JournalController(BaseController):
45 class JournalController(BaseController):
45
46
46
47
48 def __before__(self):
47 def __before__(self):
49 super(JournalController, self).__before__()
48 super(JournalController, self).__before__()
50 self.rhodecode_user = self.rhodecode_user
49 self.rhodecode_user = self.rhodecode_user
@@ -75,7 +74,6 b' class JournalController(BaseController):'
75 return c.journal_data
74 return c.journal_data
76 return render('journal/journal.html')
75 return render('journal/journal.html')
77
76
78
79 def _get_daily_aggregate(self, journal):
77 def _get_daily_aggregate(self, journal):
80 groups = []
78 groups = []
81 for k, g in groupby(journal, lambda x:x.action_as_day):
79 for k, g in groupby(journal, lambda x: x.action_as_day):
@@ -88,7 +86,6 b' class JournalController(BaseController):'
88
86
89 return groups
87 return groups
90
88
91
92 def _get_journal_data(self, following_repos):
89 def _get_journal_data(self, following_repos):
93 repo_ids = [x.follows_repository.repo_id for x in following_repos
90 repo_ids = [x.follows_repository.repo_id for x in following_repos
94 if x.follows_repository is not None]
91 if x.follows_repository is not None]
@@ -113,7 +110,6 b' class JournalController(BaseController):'
113 else:
110 else:
114 journal = []
111 journal = []
115
112
116
117 return journal
113 return journal
118
114
119 @LoginRequired()
115 @LoginRequired()
@@ -141,12 +137,9 b' class JournalController(BaseController):'
141 except:
137 except:
142 raise HTTPBadRequest()
138 raise HTTPBadRequest()
143
139
144
145 log.debug('token mismatch %s vs %s', cur_token, token)
140 log.debug('token mismatch %s vs %s', cur_token, token)
146 raise HTTPBadRequest()
141 raise HTTPBadRequest()
147
142
148
149
150 @LoginRequired()
143 @LoginRequired()
151 def public_journal(self):
144 def public_journal(self):
152 # Return a rendered template
145 # Return a rendered template
@@ -168,7 +161,6 b' class JournalController(BaseController):'
168 return c.journal_data
161 return c.journal_data
169 return render('journal/public_journal.html')
162 return render('journal/public_journal.html')
170
163
171
172 @LoginRequired(api_access=True)
164 @LoginRequired(api_access=True)
173 def public_journal_atom(self):
165 def public_journal_atom(self):
174 """
166 """
@@ -41,6 +41,7 b' from rhodecode.model.user import UserMod'
41
41
42 log = logging.getLogger(__name__)
42 log = logging.getLogger(__name__)
43
43
44
44 class LoginController(BaseController):
45 class LoginController(BaseController):
45
46
46 def __before__(self):
47 def __before__(self):
@@ -93,7 +94,8 b' class LoginController(BaseController):'
93 def register(self):
94 def register(self):
94 user_model = UserModel()
95 user_model = UserModel()
95 c.auto_active = False
96 c.auto_active = False
96 for perm in user_model.get_by_username('default', cache=False).user_perms:
97 for perm in user_model.get_by_username('default',
98 cache=False).user_perms:
97 if perm.permission.permission_name == 'hg.register.auto_activate':
99 if perm.permission.permission_name == 'hg.register.auto_activate':
98 c.auto_active = True
100 c.auto_active = True
99 break
101 break
@@ -41,6 +41,7 b' from whoosh.query import Phrase'
41
41
42 log = logging.getLogger(__name__)
42 log = logging.getLogger(__name__)
43
43
44
44 class SearchController(BaseController):
45 class SearchController(BaseController):
45
46
46 @LoginRequired()
47 @LoginRequired()
@@ -59,7 +60,6 b' class SearchController(BaseController):'
59 'repository':'repository'}\
60 'repository': 'repository'}\
60 .get(c.cur_type, 'content')
61 .get(c.cur_type, 'content')
61
62
62
63 if c.cur_query:
63 if c.cur_query:
64 cur_query = c.cur_query.lower()
64 cur_query = c.cur_query.lower()
65
65
@@ -67,8 +67,8 b' class SearchController(BaseController):'
67 p = int(request.params.get('page', 1))
67 p = int(request.params.get('page', 1))
68 highlight_items = set()
68 highlight_items = set()
69 try:
69 try:
70 idx = open_dir(config['app_conf']['index_dir']
70 idx = open_dir(config['app_conf']['index_dir'],
71 , indexname=IDX_NAME)
71 indexname=IDX_NAME)
72 searcher = idx.searcher()
72 searcher = idx.searcher()
73
73
74 qp = QueryParser(search_type, schema=SCHEMA)
74 qp = QueryParser(search_type, schema=SCHEMA)
@@ -103,7 +103,6 b' class SearchController(BaseController):'
103 page=p, item_count=res_ln,
103 page=p, item_count=res_ln,
104 items_per_page=10, url=url_generator)
104 items_per_page=10, url=url_generator)
105
105
106
107 except QueryParserError:
106 except QueryParserError:
108 c.runtime = _('Invalid search query. Try quoting it.')
107 c.runtime = _('Invalid search query. Try quoting it.')
109 searcher.close()
108 searcher.close()
@@ -46,6 +46,7 b' from rhodecode.model.db import User'
46
46
47 log = logging.getLogger(__name__)
47 log = logging.getLogger(__name__)
48
48
49
49 class SettingsController(BaseRepoController):
50 class SettingsController(BaseRepoController):
50
51
51 @LoginRequired()
52 @LoginRequired()
@@ -99,7 +100,8 b' class SettingsController(BaseRepoControl'
99 def update(self, repo_name):
100 def update(self, repo_name):
100 repo_model = RepoModel()
101 repo_model = RepoModel()
101 changed_name = repo_name
102 changed_name = repo_name
102 _form = RepoSettingsForm(edit=True, old_data={'repo_name':repo_name})()
103 _form = RepoSettingsForm(edit=True,
104 old_data={'repo_name': repo_name})()
103 try:
105 try:
104 form_result = _form.to_python(dict(request.POST))
106 form_result = _form.to_python(dict(request.POST))
105 repo_model.update(repo_name, form_result)
107 repo_model.update(repo_name, form_result)
@@ -126,7 +128,6 b' class SettingsController(BaseRepoControl'
126
128
127 return redirect(url('repo_settings_home', repo_name=changed_name))
129 return redirect(url('repo_settings_home', repo_name=changed_name))
128
130
129
130 @HasRepoPermissionAllDecorator('repository.admin')
131 @HasRepoPermissionAllDecorator('repository.admin')
131 def delete(self, repo_name):
132 def delete(self, repo_name):
132 """DELETE /repos/repo_name: Delete an existing item"""
133 """DELETE /repos/repo_name: Delete an existing item"""
@@ -34,8 +34,6 b' from rhodecode.lib.helpers import RepoPa'
34 log = logging.getLogger(__name__)
34 log = logging.getLogger(__name__)
35
35
36
36
37
38
39 class ShortlogController(BaseRepoController):
37 class ShortlogController(BaseRepoController):
40
38
41 @LoginRequired()
39 @LoginRequired()
@@ -46,7 +44,8 b' class ShortlogController(BaseRepoControl'
46
44
47 def index(self):
45 def index(self):
48 p = int(request.params.get('page', 1))
46 p = int(request.params.get('page', 1))
49 c.repo_changesets = RepoPage(c.rhodecode_repo, page=p, items_per_page=20)
47 c.repo_changesets = RepoPage(c.rhodecode_repo, page=p,
48 items_per_page=20)
50 c.shortlog_data = render('shortlog/shortlog_data.html')
49 c.shortlog_data = render('shortlog/shortlog_data.html')
51 if request.params.get('partial'):
50 if request.params.get('partial'):
52 return c.shortlog_data
51 return c.shortlog_data
@@ -51,6 +51,7 b' except ImportError:'
51 import simplejson as json
51 import simplejson as json
52 log = logging.getLogger(__name__)
52 log = logging.getLogger(__name__)
53
53
54
54 class SummaryController(BaseRepoController):
55 class SummaryController(BaseRepoController):
55
56
56 @LoginRequired()
57 @LoginRequired()
@@ -66,13 +67,12 b' class SummaryController(BaseRepoControll'
66
67
67 c.following = self.scm_model.is_following_repo(repo_name,
68 c.following = self.scm_model.is_following_repo(repo_name,
68 self.rhodecode_user.user_id)
69 self.rhodecode_user.user_id)
70
69 def url_generator(**kw):
71 def url_generator(**kw):
70 return url('shortlog_home', repo_name=repo_name, **kw)
72 return url('shortlog_home', repo_name=repo_name, **kw)
71
73
72 c.repo_changesets = RepoPage(c.rhodecode_repo, page=1, items_per_page=10,
74 c.repo_changesets = RepoPage(c.rhodecode_repo, page=1,
73 url=url_generator)
75 items_per_page=10, url=url_generator)
74
75
76
76
77 if self.rhodecode_user.username == 'default':
77 if self.rhodecode_user.username == 'default':
78 #for default(anonymous) user we don't need to pass credentials
78 #for default(anonymous) user we don't need to pass credentials
@@ -82,10 +82,10 b' class SummaryController(BaseRepoControll'
82 username = str(self.rhodecode_user.username)
82 username = str(self.rhodecode_user.username)
83 password = '@'
83 password = '@'
84
84
85 uri = u'%(protocol)s://%(user)s%(password)s%(host)s%(prefix)s/%(repo_name)s' % {
85 uri = u'%(proto)s://%(user)s%(pass)s%(host)s%(prefix)s/%(repo_name)s' \
86 'protocol': e.get('wsgi.url_scheme'),
86 % {'proto': e.get('wsgi.url_scheme'),
87 'user':username,
87 'user': username,
88 'password':password,
88 'pass': password,
89 'host':e.get('HTTP_HOST'),
89 'host': e.get('HTTP_HOST'),
90 'prefix':e.get('SCRIPT_NAME'),
90 'prefix': e.get('SCRIPT_NAME'),
91 'repo_name':repo_name, }
91 'repo_name': repo_name, }
@@ -156,8 +156,6 b' class SummaryController(BaseRepoControll'
156
156
157 return render('summary/summary.html')
157 return render('summary/summary.html')
158
158
159
160
161 def _get_download_links(self, repo):
159 def _get_download_links(self, repo):
162
160
163 download_l = []
161 download_l = []
@@ -32,6 +32,7 b' from rhodecode.lib.utils import OrderedD'
32
32
33 log = logging.getLogger(__name__)
33 log = logging.getLogger(__name__)
34
34
35
35 class TagsController(BaseRepoController):
36 class TagsController(BaseRepoController):
36
37
37 @LoginRequired()
38 @LoginRequired()
General Comments 0
You need to be logged in to leave comments. Login now