diff pylons_app/model/hg_model.py @ 316:3a66e7421a99

db model fix, added repo instance to cached repos list
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 28 Jun 2010 21:42:06 +0200
parents cd2ee462fc2c
children d8d471cfa093
line wrap: on
line diff
--- a/pylons_app/model/hg_model.py	Mon Jun 28 21:39:48 2010 +0200
+++ b/pylons_app/model/hg_model.py	Mon Jun 28 21:42:06 2010 +0200
@@ -2,6 +2,7 @@
 # encoding: utf-8
 # Model for hg app
 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
+from sqlalchemy.orm import joinedload
  
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -116,6 +117,7 @@
                     repos_list[name].name = name
                     dbrepo = sa.query(Repository).get(name)
                     if dbrepo:
+                        repos_list[name].dbrepo = dbrepo
                         repos_list[name].description = dbrepo.description
                         repos_list[name].contact = dbrepo.user.full_contact
             except OSError:
@@ -149,7 +151,7 @@
             tmp_d['contact_sort'] = tmp_d['contact']
             tmp_d['repo_archives'] = list(repo._get_archives())
             tmp_d['last_msg'] = tip.message
-            
+            tmp_d['repo'] = repo
             yield tmp_d
 
     def get_repo(self, repo_name):