diff pylons_app/controllers/admin/settings.py @ 489:460ad816820d celery

fixed bug when new repo had no last commiter, fixed bug when my_account updating information failed, by not uniq email address.
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 20 Sep 2010 22:47:20 +0200
parents 6b934c9607e7
children 48be953851fc
line wrap: on
line diff
--- a/pylons_app/controllers/admin/settings.py	Sun Sep 19 03:42:48 2010 +0200
+++ b/pylons_app/controllers/admin/settings.py	Mon Sep 20 22:47:20 2010 +0200
@@ -38,7 +38,7 @@
     ApplicationUiSettingsForm
 from pylons_app.model.hg_model import HgModel
 from pylons_app.model.user_model import UserModel
-from pylons_app.lib.celerylib import tasks,run_task
+from pylons_app.lib.celerylib import tasks, run_task
 import formencode
 import logging
 import traceback
@@ -105,8 +105,8 @@
         
         if setting_id == 'whoosh':
             repo_location = get_hg_ui_settings()['paths_root_path']
-            full_index = request.POST.get('full_index',False)
-            task = run_task(tasks.whoosh_index,repo_location,full_index)
+            full_index = request.POST.get('full_index', False)
+            task = run_task(tasks.whoosh_index, repo_location, full_index)
             
             h.flash(_('Whoosh reindex task scheduled'), category='success')
         if setting_id == 'global':
@@ -260,7 +260,8 @@
         # url('admin_settings_my_account_update', id=ID)
         user_model = UserModel()
         uid = c.hg_app_user.user_id
-        _form = UserForm(edit=True, old_data={'user_id':uid})()
+        _form = UserForm(edit=True, old_data={'user_id':uid,
+                                              'email':c.hg_app_user.email})()
         form_result = {}
         try:
             form_result = _form.to_python(dict(request.POST))
@@ -269,7 +270,11 @@
                     category='success')
                            
         except formencode.Invalid as errors:
-            #c.user = self.sa.query(User).get(c.hg_app_user.user_id)
+            c.user = self.sa.query(User).get(c.hg_app_user.user_id)
+            c.user_repos = []
+            for repo in c.cached_repo_list.values():
+                if repo.dbrepo.user.username == c.user.username:
+                    c.user_repos.append(repo)            
             return htmlfill.render(
                 render('admin/users/user_edit_my_account.html'),
                 defaults=errors.value,