Mercurial > public > src > rhodecode
diff rhodecode/controllers/admin/repos.py @ 2562:12fa0c19c42f beta
validating choices for landing_rev
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 15 Jun 2012 00:05:20 +0200 |
parents | 9492ab68331f |
children | 1f9c467e01eb |
line wrap: on
line diff
--- a/rhodecode/controllers/admin/repos.py Thu Jun 14 23:19:26 2012 +0200 +++ b/rhodecode/controllers/admin/repos.py Fri Jun 15 00:05:20 2012 +0200 @@ -70,7 +70,8 @@ repo_model = RepoModel() c.users_array = repo_model.get_users_js() c.users_groups_array = repo_model.get_users_groups_js() - c.landing_revs = ScmModel().get_repo_landing_revs() + choices, c.landing_revs = ScmModel().get_repo_landing_revs() + c.landing_revs_choices = choices def __load_data(self, repo_name=None): """ @@ -92,7 +93,9 @@ return redirect(url('repos')) - c.landing_revs = ScmModel().get_repo_landing_revs(c.repo_info) + choices, c.landing_revs = ScmModel().get_repo_landing_revs(c.repo_info) + c.landing_revs_choices = choices + c.default_user_id = User.get_by_username('default').user_id c.in_public_journal = UserFollowing.query()\ .filter(UserFollowing.user_id == c.default_user_id)\ @@ -140,7 +143,8 @@ self.__load_defaults() form_result = {} try: - form_result = RepoForm(repo_groups=c.repo_groups_choices)()\ + form_result = RepoForm(repo_groups=c.repo_groups_choices, + landing_revs=c.landing_revs_choices)()\ .to_python(dict(request.POST)) RepoModel().create(form_result, self.rhodecode_user) if form_result['clone_uri']: @@ -208,7 +212,8 @@ repo_model = RepoModel() changed_name = repo_name _form = RepoForm(edit=True, old_data={'repo_name': repo_name}, - repo_groups=c.repo_groups_choices)() + repo_groups=c.repo_groups_choices, + landing_revs=c.landing_revs_choices)() try: form_result = _form.to_python(dict(request.POST)) repo = repo_model.update(repo_name, form_result)