comparison rhodecode/model/__init__.py @ 1155:37a9421f32a0 beta

Added handy methods to Repository model for fetching groups with parents
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 18 Mar 2011 22:04:21 +0100
parents 07a6e8c65526
children 6832ef664673
comparison
equal deleted inserted replaced
1154:36fe593dfe4b 1155:37a9421f32a0
42 # along with this program; if not, write to the Free Software 42 # along with this program; if not, write to the Free Software
43 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 43 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
44 # MA 02110-1301, USA. 44 # MA 02110-1301, USA.
45 45
46 import logging 46 import logging
47
47 from rhodecode.model import meta 48 from rhodecode.model import meta
49
48 log = logging.getLogger(__name__) 50 log = logging.getLogger(__name__)
49 51
50 def init_model(engine): 52 def init_model(engine):
51 """Initializes db session, bind the engine with the metadata, 53 """Initializes db session, bind the engine with the metadata,
52 Call this before using any of the tables or classes in the model, preferably 54 Call this before using any of the tables or classes in the model, preferably
53 once in application start 55 once in application start
54 56
55 :param engine: engine to bind to 57 :param engine: engine to bind to
56 """ 58 """
57 log.info("initializing db models for %s", engine) 59 log.info("initializing db for %s", engine)
58 meta.Base.metadata.bind = engine 60 meta.Base.metadata.bind = engine
59 61
60 class BaseModel(object): 62 class BaseModel(object):
61 """Base Model for all RhodeCode models, it adds sql alchemy session 63 """Base Model for all RhodeCode models, it adds sql alchemy session
62 into instance of model 64 into instance of model