summaryrefslogtreecommitdiffstats
path: root/authentic/admin/settings.ptl
diff options
context:
space:
mode:
authorDamien Laniel <dlaniel@entrouvert.com>2007-08-22 10:24:33 (GMT)
committerDamien Laniel <dlaniel@entrouvert.com>2007-08-22 10:24:33 (GMT)
commit5d08257aa886338e1c6cd3caf7e3fe4d8d0a1551 (patch)
tree20fb485f16c8f23a8a485cba1ad8ab8f697e4f9f /authentic/admin/settings.ptl
parentf46ce9bd712f78edfddde1a033f6e24dfc83a074 (diff)
downloadauthentic-old-5d08257aa886338e1c6cd3caf7e3fe4d8d0a1551.zip
authentic-old-5d08257aa886338e1c6cd3caf7e3fe4d8d0a1551.tar.gz
authentic-old-5d08257aa886338e1c6cd3caf7e3fe4d8d0a1551.tar.bz2
check postgresql database connection during configuration
Diffstat (limited to 'authentic/admin/settings.ptl')
-rw-r--r--authentic/admin/settings.ptl26
1 files changed, 22 insertions, 4 deletions
diff --git a/authentic/admin/settings.ptl b/authentic/admin/settings.ptl
index d950858..ed31a25 100644
--- a/authentic/admin/settings.ptl
+++ b/authentic/admin/settings.ptl
@@ -999,13 +999,20 @@ class SettingsDirectory(Directory):
if form.get_submit() == 'cancel':
return redirect('.')
+ form_error = None
if form.is_submitted() and not (form.has_errors() or redo):
- self.identity_storage_submit(form)
- return redirect('.')
+ try:
+ self.identity_storage_submit(form)
+ except identities.IdentityStoreException, e:
+ form_error = e
+ else:
+ return redirect('.')
get_response().breadcrumb.append(('identity_storage', _('Identity Storage')))
html_top('settings', title = _('Identity Storage'))
'<h2>%s</h2>' % _('Identity Storage')
+ if form_error:
+ '<div class="errornotice">%s</div>' % e
if data_source.get('locked') is not None:
'<div class="infonotice">'
data_source.get('locked')
@@ -1022,8 +1029,19 @@ class SettingsDirectory(Directory):
for k in temp_store.admin_keys:
if form.get_widget(k):
get_publisher().cfg['identity_storage'][k] = form.get_widget(k).parse()
- get_publisher().write_cfg()
- identities.load_store()
+ store = identities.load_store()
+ try:
+ store.load_identities()
+ except identities.IdentityStoreException, e:
+ # Rollback configuration changes
+ get_publisher().reload_cfg()
+ # XXX : Not sure this line is really useful
+ identities.load_store()
+ # Propagate the Exception which has to be caught by the caller
+ raise e
+ else:
+ # Commit configuration changes
+ get_publisher().write_cfg()
def idp [html] (self):
get_publisher().reload_cfg()