changeset 4090:7676606f7622

Added more detailed (and localized) information if hgsubversion is not installed while enabling from settings
author Grzegorz Rożniecki <xaerxess@gmail.com>
date Wed, 17 Jul 2013 09:19:10 +0200
parents a5888ca796b5
children 433d6385b216
files rhodecode/controllers/admin/settings.py rhodecode/lib/exceptions.py
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/admin/settings.py	Tue Jul 16 21:54:28 2013 +0200
+++ b/rhodecode/controllers/admin/settings.py	Wed Jul 17 09:19:10 2013 +0200
@@ -41,6 +41,7 @@
     HasReposGroupPermissionAll, HasReposGroupPermissionAny, AuthUser
 from rhodecode.lib.base import BaseController, render
 from rhodecode.lib.celerylib import tasks, run_task
+from rhodecode.lib.exceptions import HgsubversionImportError
 from rhodecode.lib.utils import repo2db_mapper, set_rhodecode_config, \
     check_git_version
 from rhodecode.model.db import RhodeCodeUi, Repository, RepoGroup, \
@@ -287,6 +288,11 @@
                     sett.ui_section = 'extensions'
 
                 sett.ui_active = form_result['extensions_hgsubversion']
+                if sett.ui_active:
+                    try:
+                        import hgsubversion
+                    except ImportError:
+                        raise HgsubversionImportError
                 Session().add(sett)
 
 #                sett = RhodeCodeUi.get_by_key('hggit')
@@ -303,6 +309,12 @@
 
                 h.flash(_('Updated VCS settings'), category='success')
 
+            except HgsubversionImportError:
+                log.error(traceback.format_exc())
+                h.flash(_('Unable to activate hgsubversion support. '
+                          'The "hgsubversion" library is missing'),
+                        category='error')
+
             except Exception:
                 log.error(traceback.format_exc())
                 h.flash(_('Error occurred during updating '
--- a/rhodecode/lib/exceptions.py	Tue Jul 16 21:54:28 2013 +0200
+++ b/rhodecode/lib/exceptions.py	Wed Jul 17 09:19:10 2013 +0200
@@ -98,3 +98,7 @@
 
 class RepositoryCreationError(Exception):
     pass
+
+
+class HgsubversionImportError(Exception):
+    pass