comparison pylons_app/model/hg_model.py @ 350:664a5b8c551a

Added application settings, are now customizable from database fixed all instances of sqlachemy to be removed() after execution.
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 14 Jul 2010 18:31:06 +0200
parents d8d471cfa093
children e9a6783f5502
comparison
equal deleted inserted replaced
349:031152a540c5 350:664a5b8c551a
26 26
27 from beaker.cache import cache_region 27 from beaker.cache import cache_region
28 from mercurial import ui 28 from mercurial import ui
29 from mercurial.hgweb.hgwebdir_mod import findrepos 29 from mercurial.hgweb.hgwebdir_mod import findrepos
30 from vcs.exceptions import RepositoryError, VCSError 30 from vcs.exceptions import RepositoryError, VCSError
31 from pylons_app.model.meta import Session 31 from pylons_app.model import meta
32 from pylons_app.model.db import Repository 32 from pylons_app.model.db import Repository
33 from sqlalchemy.orm import joinedload 33 from sqlalchemy.orm import joinedload
34 import logging 34 import logging
35 import os 35 import os
36 import sys 36 import sys
79 Listing of repositories in given path. This path should not be a 79 Listing of repositories in given path. This path should not be a
80 repository itself. Return a dictionary of repository objects 80 repository itself. Return a dictionary of repository objects
81 :param repos_path: path to directory it could take syntax with 81 :param repos_path: path to directory it could take syntax with
82 * or ** for deep recursive displaying repositories 82 * or ** for deep recursive displaying repositories
83 """ 83 """
84 sa = Session() 84 sa = meta.Session()
85 def check_repo_dir(path): 85 def check_repo_dir(path):
86 """ 86 """
87 Checks the repository 87 Checks the repository
88 :param path: 88 :param path:
89 """ 89 """
120 repos_list[name].dbrepo = dbrepo 120 repos_list[name].dbrepo = dbrepo
121 repos_list[name].description = dbrepo.description 121 repos_list[name].description = dbrepo.description
122 repos_list[name].contact = dbrepo.user.full_contact 122 repos_list[name].contact = dbrepo.user.full_contact
123 except OSError: 123 except OSError:
124 continue 124 continue
125 meta.Session.remove()
125 return repos_list 126 return repos_list
126 127
127 def get_repos(self): 128 def get_repos(self):
128 for name, repo in _get_repos_cached().items(): 129 for name, repo in _get_repos_cached().items():
129 if repo._get_hidden(): 130 if repo._get_hidden():