From 033148443e73469ca341eab4fc13a86948a74b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 5 Mar 2008 15:40:18 +0100 Subject: [PATCH] Better preference window behavior Don't crash if session is timeout --- tryton/gui/window/preference.py | 4 +++- tryton/rpc.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tryton/gui/window/preference.py b/tryton/gui/window/preference.py index 8b8384b67c..0b8cb6f677 100644 --- a/tryton/gui/window/preference.py +++ b/tryton/gui/window/preference.py @@ -20,7 +20,7 @@ class Preference(object): gtk.STOCK_OK, gtk.RESPONSE_OK)) self.win.set_default_response(gtk.RESPONSE_OK) - self.win.vbox.pack_start(gtk.Label(_('Edit ressource preferences')), + self.win.vbox.pack_start(gtk.Label(_('Edit User Preferences')), expand=False, fill=True) self.win.vbox.pack_start(gtk.HSeparator()) self.win.set_icon(TRYTON_ICON) @@ -34,6 +34,7 @@ class Preference(object): res = user.get_preferences_fields_view(rpc.CONTEXT) except Exception, exception: rpc.process_exception(exception, parent) + self.win.destroy() raise arch = res['arch'] fields = res['fields'] @@ -45,6 +46,7 @@ class Preference(object): preferences = user.get_preferences(False, rpc.CONTEXT) except Exception, exception: rpc.process_exception(exception, parent) + self.win.destroy() raise self.screen.current_model.set(preferences) diff --git a/tryton/rpc.py b/tryton/rpc.py index 57ed1d9025..070b8e661b 100644 --- a/tryton/rpc.py +++ b/tryton/rpc.py @@ -89,7 +89,10 @@ def context_reload(): CONTEXT = {} user = RPCProxy('res.user') lang = RPCProxy('ir.lang') - context = user.get_preferences(True, {}) + try: + context = user.get_preferences(True, {}) + except: + return for i in context: value = context[i] if value: