From 92bb9354e596ebde1deb209dda6fbea6b85aed52 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Wed, 4 Apr 2012 01:02:18 +0200 Subject: [PATCH] [Rigo] fix undefined references --- rigo/rigo/controllers/daemon.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/rigo/rigo/controllers/daemon.py b/rigo/rigo/controllers/daemon.py index 07c757d4d..847669be3 100644 --- a/rigo/rigo/controllers/daemon.py +++ b/rigo/rigo/controllers/daemon.py @@ -541,44 +541,48 @@ class RigoServiceController(GObject.Object): app_outcome) if app_outcome != DaemonAppTransactionOutcome.SUCCESS: - self._notify_app_management_outcome(app_outcome) + self._notify_app_management_outcome(app, app_outcome) - def _notify_app_management_outcome(self, app_outcome): + def _notify_app_management_outcome(self, app, app_outcome): """ Notify User about Application Management errors. """ + if app is None: + app_name = _("Application") + else: + app_name = app.name msg = prepare_markup(_("An unknown error occurred")) if app_outcome == DaemonAppTransactionOutcome.DOWNLOAD_ERROR: msg = prepare_markup(_("%s download failed")) % ( - app.name,) + app_name,) elif app_outcome == DaemonAppTransactionOutcome.INSTALL_ERROR: msg = prepare_markup(_("%s install failed")) % ( - app.name,) + app_name,) elif app_outcome == DaemonAppTransactionOutcome.REMOVE_ERROR: msg = prepare_markup(_("%s removal failed")) % ( - app.name,) + app_name,) elif app_outcome == \ DaemonAppTransactionOutcome.PERMISSION_DENIED: msg = prepare_markup(_("%s, not authorized")) % ( - app.name,) + app_name,) elif app_outcome == DaemonAppTransactionOutcome.INTERNAL_ERROR: msg = prepare_markup(_("%s, internal error")) % ( - app.name,) + app_name,) elif app_outcome == \ DaemonAppTransactionOutcome.DEPENDENCIES_NOT_FOUND_ERROR: msg = prepare_markup( _("%s dependencies not found")) % ( - app.name,) + app_name,) elif app_outcome == \ DaemonAppTransactionOutcome.DEPENDENCIES_COLLISION_ERROR: msg = prepare_markup( _("%s dependencies collision error")) % ( - app.name,) + app_name,) elif app_outcome == \ DaemonAppTransactionOutcome.DEPENDENCIES_NOT_REMOVABLE_ERROR: msg = prepare_markup( _("%s dependencies not removable error")) % ( - app.name,) + app_name,) elif app_outcome == \ DaemonAppTransactionOutcome.DISK_FULL_ERROR: msg = prepare_markup( @@ -636,7 +640,7 @@ class RigoServiceController(GObject.Object): # because the error happened earlier, thus, re-notify # user here. if outcome != DaemonAppTransactionOutcome.SUCCESS: - self._notify_app_management_outcome(outcome) + self._notify_app_management_outcome(None, outcome) # we don't expect to fail here, it would # mean programming error.