Mercurial > public > src > rhodecode
comparison pylons_app/controllers/repos.py @ 266:32d6c955218c
added check for repo created outside of hg app
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 07 Jun 2010 00:26:52 +0200 |
parents | 0e5455fda8fd |
children | a7608dbe47fc 29370bb76fa6 |
comparison
equal
deleted
inserted
replaced
265:0e5455fda8fd | 266:32d6c955218c |
---|---|
132 | 132 |
133 repo_model = RepoModel() | 133 repo_model = RepoModel() |
134 repo = repo_model.get(id) | 134 repo = repo_model.get(id) |
135 if not repo: | 135 if not repo: |
136 h.flash(_('%s repository is not mapped to db perhaps' | 136 h.flash(_('%s repository is not mapped to db perhaps' |
137 ' it was moved or renamed please run the application again' | 137 ' it was moved or renamed from the filesystem' |
138 ' please run the application again' | |
138 ' in order to rescan repositories') % id, category='error') | 139 ' in order to rescan repositories') % id, category='error') |
139 | 140 |
140 return redirect(url('repos')) | 141 return redirect(url('repos')) |
141 try: | 142 try: |
142 repo_model.delete(repo) | 143 repo_model.delete(repo) |
154 | 155 |
155 def edit(self, id, format='html'): | 156 def edit(self, id, format='html'): |
156 """GET /repos/id/edit: Form to edit an existing item""" | 157 """GET /repos/id/edit: Form to edit an existing item""" |
157 # url('edit_repo', id=ID) | 158 # url('edit_repo', id=ID) |
158 repo_model = RepoModel() | 159 repo_model = RepoModel() |
159 c.repo_info = repo_model.get(id) | 160 c.repo_info = repo = repo_model.get(id) |
161 if not repo: | |
162 h.flash(_('%s repository is not mapped to db perhaps' | |
163 ' it was created or renamed from the filesystem' | |
164 ' please run the application again' | |
165 ' in order to rescan repositories') % id, category='error') | |
166 | |
167 return redirect(url('repos')) | |
160 defaults = c.repo_info.__dict__ | 168 defaults = c.repo_info.__dict__ |
161 defaults.update({'user':c.repo_info.user.username}) | 169 defaults.update({'user':c.repo_info.user.username}) |
162 return htmlfill.render( | 170 return htmlfill.render( |
163 render('admin/repos/repo_edit.html'), | 171 render('admin/repos/repo_edit.html'), |
164 defaults=defaults, | 172 defaults=defaults, |