comparison rhodecode/controllers/files.py @ 915:35e701dc801e beta

fixed #96 redirect loop on files
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 05 Jan 2011 23:40:25 +0100
parents 07a6e8c65526
children 32318ec7bfc1
comparison
equal deleted inserted replaced
914:110a00c181de 915:35e701dc801e
37 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator 37 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
38 from rhodecode.lib.base import BaseController, render 38 from rhodecode.lib.base import BaseController, render
39 from rhodecode.lib.utils import EmptyChangeset 39 from rhodecode.lib.utils import EmptyChangeset
40 from rhodecode.model.scm import ScmModel 40 from rhodecode.model.scm import ScmModel
41 41
42 from vcs.exceptions import RepositoryError, ChangesetError, ChangesetDoesNotExistError 42 from vcs.exceptions import RepositoryError, ChangesetError, \
43 ChangesetDoesNotExistError, EmptyRepositoryError
43 from vcs.nodes import FileNode 44 from vcs.nodes import FileNode
44 from vcs.utils import diffs as differ 45 from vcs.utils import diffs as differ
45 46
46 log = logging.getLogger(__name__) 47 log = logging.getLogger(__name__)
47 48
98 c.files_list = c.changeset.get_node(f_path) 99 c.files_list = c.changeset.get_node(f_path)
99 c.file_history = self._get_history(c.repo, c.files_list, f_path) 100 c.file_history = self._get_history(c.repo, c.files_list, f_path)
100 except RepositoryError, e: 101 except RepositoryError, e:
101 h.flash(str(e), category='warning') 102 h.flash(str(e), category='warning')
102 redirect(h.url('files_home', repo_name=repo_name, revision=revision)) 103 redirect(h.url('files_home', repo_name=repo_name, revision=revision))
104
105 except EmptyRepositoryError, e:
106 h.flash(_('There are no files yet'), category='warning')
107 redirect(h.url('summary_home', repo_name=repo_name))
103 108
104 except RepositoryError, e: 109 except RepositoryError, e:
105 h.flash(str(e), category='warning') 110 h.flash(str(e), category='warning')
106 redirect(h.url('files_home', repo_name=repo_name, revision='tip')) 111 redirect(h.url('files_home', repo_name=repo_name, revision='tip'))
107 112