##// END OF EJS Templates
routing: use a common method to extract the f_path for repo views....
marcink -
r1929:0c7b3df6 default
parent child Browse files
Show More
@@ -213,6 +213,13 b' class RepoAppView(BaseAppView):'
213 213
214 214 return c
215 215
216 def _get_f_path(self, matchdict, default=None):
217 f_path = matchdict.get('f_path')
218 if f_path:
219 # fix for multiple initial slashes that causes errors for GIT
220 return f_path.lstrip('/')
221
222 return default
216 223
217 224 class DataGridAppView(object):
218 225 """
@@ -108,7 +108,7 b' class RepoFilesView(RepoAppView):'
108 108
109 109 commit_id = self.request.matchdict.get(
110 110 'commit_id', default_commit_id)
111 f_path = self.request.matchdict.get('f_path', default_f_path)
111 f_path = self._get_f_path(self.request.matchdict, default_f_path)
112 112 return commit_id, f_path
113 113
114 114 def _get_default_encoding(self, c):
@@ -375,9 +375,9 b' class RepoFilesView(RepoAppView):'
375 375 renderer=None)
376 376 def repo_files_diff(self):
377 377 c = self.load_default_context()
378 f_path = self._get_f_path(self.request.matchdict)
378 379 diff1 = self.request.GET.get('diff1', '')
379 380 diff2 = self.request.GET.get('diff2', '')
380 f_path = self.request.matchdict['f_path']
381 381
382 382 path1, diff1 = parse_path_ref(diff1, default_path=f_path)
383 383
@@ -461,9 +461,9 b' class RepoFilesView(RepoAppView):'
461 461 """
462 462 Kept only to make OLD links work
463 463 """
464 f_path = self._get_f_path(self.request.matchdict)
464 465 diff1 = self.request.GET.get('diff1', '')
465 466 diff2 = self.request.GET.get('diff2', '')
466 f_path = self.request.matchdict['f_path']
467 467
468 468 if not any((diff1, diff2)):
469 469 h.flash(
General Comments 0
You need to be logged in to leave comments. Login now