diff pylons_app/controllers/admin/repos.py @ 383:ebdd1a89cdd9

Added extra validation in creating users. new style errors for users
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 24 Jul 2010 00:46:29 +0200
parents b0715a788432
children ec7b76d4bda4
line wrap: on
line diff
--- a/pylons_app/controllers/admin/repos.py	Sat Jul 24 00:21:57 2010 +0200
+++ b/pylons_app/controllers/admin/repos.py	Sat Jul 24 00:46:29 2010 +0200
@@ -63,7 +63,7 @@
         # url('repos')
         repo_model = RepoModel()
         _form = RepoForm()()
-        form_result = None
+        form_result = {}
         try:
             form_result = _form.to_python(dict(request.POST))
             repo_model.create(form_result, c.hg_app_user)
@@ -82,11 +82,8 @@
 
         except Exception:
             log.error(traceback.format_exc())
-            if form_result:
-                msg = _('error occured during creation of repository %s') \
-                    % form_result['repo_name']
-            else:
-                msg = _('error occured during creation of repository') 
+            msg = _('error occured during creation of repository %s') \
+                    % form_result.get('repo_name')
             h.flash(msg, category='error')
             
         return redirect('repos')