comparison pylons_app/model/forms.py @ 323:fc4027fe46bc

fixed bug when user is capable of creating _admin repository which is a link to admin interface
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 29 Jun 2010 12:32:30 +0200
parents d303aacb3349
children 05b212954275
comparison
equal deleted inserted replaced
322:7e4771a0ff43 323:fc4027fe46bc
136 def ValidRepoName(edit=False): 136 def ValidRepoName(edit=False):
137 class _ValidRepoName(formencode.validators.FancyValidator): 137 class _ValidRepoName(formencode.validators.FancyValidator):
138 138
139 def to_python(self, value, state): 139 def to_python(self, value, state):
140 slug = h.repo_name_slug(value) 140 slug = h.repo_name_slug(value)
141 141 if slug in ['_admin']:
142 raise formencode.Invalid(_('This repository name is disallowed'),
143 value, state)
142 sa = meta.Session 144 sa = meta.Session
143 if sa.query(Repository).get(slug) and not edit: 145 if sa.query(Repository).get(slug) and not edit:
144 raise formencode.Invalid(_('This repository already exists'), 146 raise formencode.Invalid(_('This repository already exists'),
145 value, state) 147 value, state)
146 148