aboutsummaryrefslogtreecommitdiff
path: root/rhodecode/model/forms.py
diff options
context:
space:
mode:
authorMarcin Kuzminski <marcin@python-works.com>2011-12-02 22:31:13 +0200
committerMarcin Kuzminski <marcin@python-works.com>2011-12-02 22:31:13 +0200
commit2516eaf83bc5d3bbe3598b4ac804fa8d2a22eae2 (patch)
treef998820581879c335ada402b4b1f1a90bd86d36f /rhodecode/model/forms.py
parentaa5347249526e2ecb86e675f58432df1ab2d7774 (diff)
commit less models
- models don't do any commits(with few exceptions) - all db transactions should be handled by higher level modules like controllers, celery tasks --HG-- branch : beta
Diffstat (limited to 'rhodecode/model/forms.py')
-rw-r--r--rhodecode/model/forms.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/rhodecode/model/forms.py b/rhodecode/model/forms.py
index 922efca2..c9843964 100644
--- a/rhodecode/model/forms.py
+++ b/rhodecode/model/forms.py
@@ -36,9 +36,7 @@ from rhodecode.config.routing import ADMIN_PREFIX
from rhodecode.lib.utils import repo_name_slug
from rhodecode.lib.auth import authenticate, get_crypt_password
from rhodecode.lib.exceptions import LdapImportError
-from rhodecode.model.user import UserModel
-from rhodecode.model.repo import RepoModel
-from rhodecode.model.db import User, UsersGroup, RepoGroup
+from rhodecode.model.db import User, UsersGroup, RepoGroup, Repository
from rhodecode import BACKENDS
log = logging.getLogger(__name__)
@@ -68,7 +66,7 @@ def ValidUsername(edit, old_data):
#check if user is unique
old_un = None
if edit:
- old_un = UserModel().get(old_data.get('user_id')).username
+ old_un = User.get(old_data.get('user_id')).username
if old_un != value or not edit:
if User.get_by_username(value, case_insensitive=True):
@@ -268,7 +266,7 @@ def ValidRepoName(edit, old_data):
if rename or create:
if group_path != '':
- if RepoModel().get_by_repo_name(repo_name_full,):
+ if Repository.get_by_repo_name(repo_name_full):
e_dict = {'repo_name':_('This repository already '
'exists in a group "%s"') %
gr.group_name}
@@ -281,7 +279,7 @@ def ValidRepoName(edit, old_data):
raise formencode.Invalid('', value, state,
error_dict=e_dict)
- elif RepoModel().get_by_repo_name(repo_name_full):
+ elif Repository.get_by_repo_name(repo_name_full):
e_dict = {'repo_name':_('This repository '
'already exists')}
raise formencode.Invalid('', value, state,