aboutsummaryrefslogtreecommitdiff
path: root/rhodecode/model/forms.py
diff options
context:
space:
mode:
authorMarcin Kuzminski <marcin@python-works.com>2011-05-26 01:28:06 +0200
committerMarcin Kuzminski <marcin@python-works.com>2011-05-26 01:28:06 +0200
commit7b05a3330931130535bd3e50e7f90ed8cbf21ecd (patch)
tree4ee0b595d12111d827372b9006079227b50bc02e /rhodecode/model/forms.py
parent11a83d27090cccabc6b00149339f1551d233707a (diff)
#47 added editing of groups, and moving them between. Added check constraint for groups
to prevent of loops --HG-- branch : beta
Diffstat (limited to 'rhodecode/model/forms.py')
-rw-r--r--rhodecode/model/forms.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/rhodecode/model/forms.py b/rhodecode/model/forms.py
index 16f65eff..e310d181 100644
--- a/rhodecode/model/forms.py
+++ b/rhodecode/model/forms.py
@@ -122,11 +122,18 @@ def ValidReposGroup(edit, old_data):
def validate_python(self, value, state):
#TODO WRITE VALIDATIONS
group_name = value.get('group_name')
- group_parent_id = value.get('group_parent_id')
+ group_parent_id = int(value.get('group_parent_id') or - 1)
# slugify repo group just in case :)
slug = repo_name_slug(group_name)
+ # check for parent of self
+ if old_data['group_id'] == group_parent_id:
+ e_dict = {'group_parent_id':_('Cannot assign this group '
+ 'as parent')}
+ raise formencode.Invalid('', value, state,
+ error_dict=e_dict)
+
old_gname = None
if edit:
old_gname = Group.get(