One more use of find_object

This commit is contained in:
Florent 2014-04-02 12:37:31 +02:00
commit 8242dbecd1

View file

@ -20,6 +20,7 @@
import time
from weboob.capabilities.messages import ICapMessages, Message, Thread
from weboob.capabilities.base import find_object
from weboob.tools.backend import BaseBackend
from weboob.tools.newsfeed import Newsfeed
@ -38,17 +39,12 @@ class GenericNewspaperBackend(BaseBackend, ICapMessages):
URL2ID = None
RSSSIZE = 0
def _get_thread(self, id):
for thread in self.iter_threads():
if thread.id == id:
return thread
def get_thread(self, _id):
if isinstance(_id, Thread):
thread = _id
id = thread.id
else:
thread = self._get_thread(_id)
thread = find_object(self.iter_threads(), id=_id)
id = _id
with self.browser: