changeset 4015:669721d1fe65

fixed edge case when connection to db fails and code reaches state of variable referenced before assignment
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 18 Jun 2013 16:39:59 +0200
parents 7c0eff86b249
children cce2d984b001
files rhodecode/lib/auth.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/auth.py	Tue Jun 18 16:20:28 2013 +0200
+++ b/rhodecode/lib/auth.py	Tue Jun 18 16:39:59 2013 +0200
@@ -501,13 +501,12 @@
     try:
         sa = meta.Session
         all_perms = sa.query(Permission).all()
+        config['available_permissions'] = [x.permission_name for x in all_perms]
     except Exception:
-        pass
+        log.error(traceback.format_exc())
     finally:
         meta.Session.remove()
 
-    config['available_permissions'] = [x.permission_name for x in all_perms]
-
 
 #==============================================================================
 # CHECK DECORATORS