##// END OF EJS Templates
small fixes for detection of groups that already exists
marcink -
r1735:344ddfee beta
parent child Browse files
Show More
@@ -120,15 +120,17 b' def ValidReposGroup(edit, old_data):'
120 120 class _ValidReposGroup(formencode.validators.FancyValidator):
121 121
122 122 def validate_python(self, value, state):
123 #TODO WRITE VALIDATIONS
123 # TODO WRITE VALIDATIONS
124 124 group_name = value.get('group_name')
125 group_parent_id = int(value.get('group_parent_id') or -1)
125 group_parent_id = value.get('group_parent_id')
126 126
127 127 # slugify repo group just in case :)
128 128 slug = repo_name_slug(group_name)
129 129
130 130 # check for parent of self
131 if edit and old_data['group_id'] == group_parent_id:
131 parent_of_self = lambda:(old_data['group_id'] == int(group_parent_id)
132 if group_parent_id else False)
133 if edit and parent_of_self():
132 134 e_dict = {'group_parent_id':_('Cannot assign this group '
133 135 'as parent')}
134 136 raise formencode.Invalid('', value, state,
@@ -136,10 +138,10 b' def ValidReposGroup(edit, old_data):'
136 138
137 139 old_gname = None
138 140 if edit:
139 old_gname = RepoGroup.get(
140 old_data.get('group_id')).group_name
141 old_gname = RepoGroup.get(old_data.get('group_id')).group_name
141 142
142 143 if old_gname != group_name or not edit:
144
143 145 # check filesystem
144 146 gr = RepoGroup.query().filter(RepoGroup.group_name == slug)\
145 147 .filter(RepoGroup.group_parent_id == group_parent_id).scalar()
General Comments 0
You need to be logged in to leave comments. Login now