The models Module

rhodecode.model.__init__

The application’s model objects

created_on:

Nov 25, 2010

author:

marcink

copyright:
  1. 2010-2012 Marcin Kuzminski <marcin@python-works.com>
license:

GPLv3, see COPYING for more details.

example:
from paste.deploy import appconfig
from pylons import config
from sqlalchemy import engine_from_config
from rhodecode.config.environment import load_environment

conf = appconfig('config:development.ini', relative_to = './../../')
load_environment(conf.global_conf, conf.local_conf)

engine = engine_from_config(config, 'sqlalchemy.')
init_model(engine)
# RUN YOUR CODE HERE
class rhodecode.model.BaseModel(sa=None)[source]

Base Model for all RhodeCode models, it adds sql alchemy session into instance of model

Parameters:sa – If passed it reuses this session instead of creating a new one
get_all()[source]

Returns all instances of what is defined in cls class variable

rhodecode.model.init_model(engine)[source]

Initializes db session, bind the engine with the metadata, Call this before using any of the tables or classes in the model, preferably once in application start

Parameters:engine – engine to bind to

rhodecode.model.comment

comments model for RhodeCode

created_on:

Nov 11, 2011

author:

marcink

copyright:
  1. 2011-2012 Marcin Kuzminski <marcin@python-works.com>
license:

GPLv3, see COPYING for more details.

rhodecode.model.notification

Model for notifications

created_on:

Nov 20, 2011

author:

marcink

copyright:
  1. 2010-2012 Marcin Kuzminski <marcin@python-works.com>
license:

GPLv3, see COPYING for more details.

rhodecode.model.permission

permissions model for RhodeCode

created_on:

Aug 20, 2010

author:

marcink

copyright:
  1. 2010-2012 Marcin Kuzminski <marcin@python-works.com>
license:

GPLv3, see COPYING for more details.

class rhodecode.model.permission.PermissionModel(sa=None)[source]

Permissions model for RhodeCode

rhodecode.model.users_group

repository permission model for RhodeCode

created_on:

Oct 1, 2011

author:

nvinot, marcink

copyright:
  1. 2011-2011 Nicolas Vinot <aeris@imirhil.fr>
copyright:
  1. 2011-2012 Marcin Kuzminski <marcin@python-works.com>
license:

GPLv3, see COPYING for more details.

rhodecode.model.repo

Repository model for rhodecode

created_on:

Jun 5, 2010

author:

marcink

copyright:
  1. 2010-2012 Marcin Kuzminski <marcin@python-works.com>
license:

GPLv3, see COPYING for more details.

rhodecode.model.user_group

repo group model for RhodeCode

created_on:

Jan 25, 2011

author:

marcink

copyright:
  1. 2011-2012 Marcin Kuzminski <marcin@python-works.com>
license:

GPLv3, see COPYING for more details.

rhodecode.model.scm

Scm model for RhodeCode

created_on:

Apr 9, 2010

author:

marcink

copyright:
  1. 2010-2012 Marcin Kuzminski <marcin@python-works.com>
license:

GPLv3, see COPYING for more details.

class rhodecode.model.scm.CachedRepoList(db_repo_list, repos_path, order_by=None, perm_set=None)[source]

Cached repo list, uses in-memory cache after initialization, that is super fast

class rhodecode.model.scm.ScmModel(sa=None)[source]

Generic Scm Model

commit_change(repo, repo_name, cs, user, author, message, content, f_path)[source]

Commits changes

Parameters:repo – SCM instance
get_nodes(repo_name, revision, root_path='/', flat=True)[source]

recursive walk in root dir and return a set of all path in that dir based on repository walk function

Parameters:
  • repo_name – name of repository
  • revision – revision for which to list nodes
  • root_path – root path to list
  • flat – return as a list, if False returns a dict with decription
get_repo_landing_revs(repo=None)[source]

Generates select option with tags branches and bookmarks (for hg only) grouped by type

Parameters:repo
get_repos(all_repos=None, sort_key=None, simple=False)[source]

Get all repos from db and for each repo create it’s backend instance and fill that backed with information from database

Parameters:
  • all_repos – list of repository names as strings give specific repositories list, good for filtering
  • sort_key – initial sorting of repos
  • simple – use SimpleCachedList - one without the SCM info
install_git_hook(repo, force_create=False)[source]

Creates a rhodecode hook inside a git repository

Parameters:
  • repo – Instance of VCS repo
  • force_create – Create even if same name hook exists
mark_for_invalidation(repo_name)[source]

Puts cache invalidation task into db for further global cache invalidation

Parameters:repo_name – this repo that should invalidation take place
repo_scan(repos_path=None)[source]

Listing of repositories in given path. This path should not be a repository itself. Return a dictionary of repository objects

Parameters:repos_path – path to directory containing repositories
repos_path[source]

Get’s the repositories root path from database

class rhodecode.model.scm.SimpleCachedRepoList(db_repo_list, repos_path, order_by=None, perm_set=None)[source]

Lighter version of CachedRepoList without the scm initialisation

rhodecode.model.user

users model for RhodeCode

created_on:

Apr 9, 2010

author:

marcink

copyright:
  1. 2010-2012 Marcin Kuzminski <marcin@python-works.com>
license:

GPLv3, see COPYING for more details.

rhodecode.model.users_group

user group model for RhodeCode

created_on:

Oct 1, 2011

author:

nvinot

copyright:
  1. 2011-2011 Nicolas Vinot <aeris@imirhil.fr>
copyright:
  1. 2010-2012 Marcin Kuzminski <marcin@python-works.com>
license:

GPLv3, see COPYING for more details.