changeset 831:165a97509a15 beta

fixed small issue with caching, call to ScmModel().get needs to be before queries for new objects of Repository
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 10 Dec 2010 20:51:54 +0100
parents e46d25e5921b
children 634596f81cfd
files rhodecode/controllers/admin/repos.py
diffstat 1 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/admin/repos.py	Fri Dec 10 19:46:50 2010 +0100
+++ b/rhodecode/controllers/admin/repos.py	Fri Dec 10 20:51:54 2010 +0100
@@ -265,8 +265,17 @@
         """GET /repos/repo_name/edit: Form to edit an existing item"""
         # url('edit_repo', repo_name=ID)
         repo_model = RepoModel()
+        r = ScmModel().get(repo_name)
         c.repo_info = repo_model.get_by_repo_name(repo_name)
-        r = ScmModel().get(repo_name)
+
+        if c.repo_info is None:
+            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') % repo_name,
+                      category='error')
+
+            return redirect(url('repos'))
 
         if c.repo_info.stats:
             last_rev = c.repo_info.stats.stat_on_revision
@@ -282,15 +291,6 @@
             c.stats_percentage = '%.2f' % ((float((last_rev)) /
                                             c.repo_last_rev) * 100)
 
-        if not c.repo_info:
-            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') % repo_name,
-                      category='error')
-
-            return redirect(url('repos'))
-
         defaults = c.repo_info.__dict__.copy()
         if c.repo_info.user:
             defaults.update({'user':c.repo_info.user.username})