Changeset - 339d1368c10d
[Not reviewed]
default
0 1 0
Marcin Kuzminski - 15 years ago 2010-07-24 00:51:57
marcin@python-works.com
new style error display for settings, added flash msg for repo rescan
1 file changed with 6 insertions and 14 deletions:
0 comments (0 inline, 0 general)
pylons_app/controllers/admin/settings.py
Show inline comments
 
#!/usr/bin/env python
 
# encoding: utf-8
 
# settings controller for pylons
 
# Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
 

	
 
#
 
# This program is free software; you can redistribute it and/or
 
# modify it under the terms of the GNU General Public License
 
# as published by the Free Software Foundation; version 2
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
# This program is distributed in the hope that it will be useful,
 
@@ -91,12 +91,13 @@ class SettingsController(BaseController)
 
            rm_obsolete = request.POST.get('destroy', False)
 
            log.debug('Rescanning directories with destroy=%s', rm_obsolete)
 

	
 
            initial = HgModel.repo_scan(g.paths[0][0], g.paths[0][1], g.baseui)
 
            repo2db_mapper(initial, rm_obsolete)
 
            invalidate_cache('cached_repo_list')
 
            h.flash(_('Repositories sucessfully rescanned'), category='success')            
 
        
 
        if id == 'global':
 
            
 
            application_form = ApplicationSettingsForm()()
 
            try:
 
                form_result = application_form.to_python(dict(request.POST))
 
@@ -120,30 +121,21 @@ class SettingsController(BaseController)
 
                            category='error')
 
                                
 
                    self.sa.rollback()
 
                    
 

	
 
            except formencode.Invalid as errors:
 
                c.form_errors = errors.error_dict
 
                return htmlfill.render(
 
                     render('admin/settings/settings.html'),
 
                    defaults=errors.value,
 
                    encoding="UTF-8") 
 
                     defaults=errors.value,
 
                     errors=errors.error_dict or {},
 
                     prefix_error=False,
 
                     encoding="UTF-8") 
 
                        
 
            
 
            
 
            
 
            
 

	
 
            
 
        return redirect(url('admin_settings'))
 

	
 

	
 

	
 

	
 

	
 
    def delete(self, id):
 
        """DELETE /admin/settings/id: Delete an existing item"""
 
        # Forms posted to this method should contain a hidden field:
 
        #    <input type="hidden" name="_method" value="DELETE" />
 
        # Or using helpers:
 
        #    h.form(url('admin_setting', id=ID),
0 comments (0 inline, 0 general)