aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Kuzminski <marcin@python-works.com>2013-05-17 20:58:31 +0200
committerMarcin Kuzminski <marcin@python-works.com>2013-05-17 20:58:31 +0200
commita58223dbfbc0b48f0302260d6462fe72026ee242 (patch)
treec2d244a547eced3285f253071952eb027986c43e
parent45e0fa1ae6b05f4785cde57bf217bfa39b582b36 (diff)
downloadrhodecode-a58223dbfbc0b48f0302260d6462fe72026ee242.tar.gz
fix required repo_type param on repo edit formHEADmaster
--HG-- extra : amend_source : ea5e59cfe6f88aa4abe00cfa2b209918e66f9c10
-rw-r--r--rhodecode/controllers/admin/repos.py10
-rw-r--r--rhodecode/model/forms.py3
2 files changed, 9 insertions, 4 deletions
diff --git a/rhodecode/controllers/admin/repos.py b/rhodecode/controllers/admin/repos.py
index ad2aa28..3a19ef0 100644
--- a/rhodecode/controllers/admin/repos.py
+++ b/rhodecode/controllers/admin/repos.py
@@ -254,11 +254,15 @@ class ReposController(BaseRepoController):
choices, c.landing_revs = ScmModel().get_repo_landing_revs(repo_name)
c.landing_revs_choices = choices
repo = Repository.get_by_repo_name(repo_name)
- _form = RepoForm(edit=True, old_data={'repo_name': repo_name,
- 'repo_group': repo.group.get_dict() \
- if repo.group else {}},
+ old_data = {
+ 'repo_name': repo_name,
+ 'repo_group': repo.group.get_dict() if repo.group else {},
+ 'repo_type': repo.repo_type,
+ }
+ _form = RepoForm(edit=True, old_data=old_data,
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)
diff --git a/rhodecode/model/forms.py b/rhodecode/model/forms.py
index 5642ffd..4593630 100644
--- a/rhodecode/model/forms.py
+++ b/rhodecode/model/forms.py
@@ -184,7 +184,8 @@ def RepoForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(),
v.SlugifyName())
repo_group = All(v.CanWriteGroup(old_data),
v.OneOf(repo_groups, hideList=True))
- repo_type = v.OneOf(supported_backends)
+ repo_type = v.OneOf(supported_backends, required=False,
+ if_missing=old_data.get('repo_type'))
repo_description = v.UnicodeString(strip=True, min=1, not_empty=False)
repo_private = v.StringBoolean(if_missing=False)
repo_landing_rev = v.OneOf(landing_revs, hideList=True)