changeset 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 c3661cf28bec
files pylons_app/controllers/repos.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pylons_app/controllers/repos.py	Mon Jun 07 00:18:33 2010 +0200
+++ b/pylons_app/controllers/repos.py	Mon Jun 07 00:26:52 2010 +0200
@@ -134,7 +134,8 @@
         repo = repo_model.get(id)
         if not repo:
             h.flash(_('%s repository is not mapped to db perhaps' 
-                      ' it was moved or renamed please run the application again'
+                      ' it was moved or renamed  from the filesystem'
+                      ' please run the application again'
                       ' in order to rescan repositories') % id, category='error')
         
             return redirect(url('repos'))
@@ -156,7 +157,14 @@
         """GET /repos/id/edit: Form to edit an existing item"""
         # url('edit_repo', id=ID)
         repo_model = RepoModel()
-        c.repo_info = repo_model.get(id)
+        c.repo_info = repo = repo_model.get(id)
+        if not repo:
+            h.flash(_('%s repository is not mapped to db perhaps' 
+                      ' it was created or renamed from the filesystem'
+                      ' please run the application again'
+                      ' in order to rescan repositories') % id, category='error')
+        
+            return redirect(url('repos'))        
         defaults = c.repo_info.__dict__
         defaults.update({'user':c.repo_info.user.username})        
         return htmlfill.render(