From 2a0d4a5e7fed28acc1b474703cde5e96f7c1ded8 Mon Sep 17 00:00:00 2001 From: Florent Date: Thu, 27 Feb 2014 16:03:57 +0100 Subject: [PATCH] Do not try to get status of not loaded backends --- weboob/applications/parceloob/parceloob.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/weboob/applications/parceloob/parceloob.py b/weboob/applications/parceloob/parceloob.py index 338abf87..61e5892d 100644 --- a/weboob/applications/parceloob/parceloob.py +++ b/weboob/applications/parceloob/parceloob.py @@ -35,6 +35,11 @@ STATUS = {Parcel.STATUS_PLANNED: ('PLANNED', 'red'), Parcel.STATUS_UNKNOWN: ('', 'white'), } + +def get_backend_name(backend): + return backend.name + + class HistoryFormatter(IFormatter): MANDATORY_FIELDS = () @@ -140,8 +145,17 @@ class Parceloob(ReplApplication): Display status for all of the tracked parcels. """ + backends = map(get_backend_name, self.enabled_backends) self.start_format() for id in self.storage.get('tracking', default=[]): + # It should be safe to do it here, since all objects in storage + # are stored with the fullid + _id, backend_name = id.rsplit('@', 1) + # If the user use the -b or -e option, do not try to get + # the status of parcel of not loaded backends + if backend_name not in backends: + continue + p = self.get_object(id, 'get_parcel_tracking') if p is None: continue