diff pylons_app/controllers/admin/settings.py @ 545:b5e1a66b4aac demo

Merge with 5a650ddd50abdfd6b7f496e025e78c61ab44a1f6 default branch
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 23 Sep 2010 01:24:57 +0200
parents a977818fbc6d 460ad816820d
children 182ee00df287
line wrap: on
line diff
--- a/pylons_app/controllers/admin/settings.py	Sat Sep 11 02:57:18 2010 +0200
+++ b/pylons_app/controllers/admin/settings.py	Thu Sep 23 01:24:57 2010 +0200
@@ -38,6 +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
 import formencode
 import logging
 import traceback
@@ -102,6 +103,12 @@
             invalidate_cache('cached_repo_list')
             h.flash(_('Repositories sucessfully rescanned'), category='success')            
         
+        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)
+            
+            h.flash(_('Whoosh reindex task scheduled'), category='success')
         if setting_id == 'global':
             
             application_form = ApplicationSettingsForm()()
@@ -253,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))
@@ -262,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,