One more use of find_object
This commit is contained in:
parent
f6ee441d08
commit
8242dbecd1
1 changed files with 2 additions and 6 deletions
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
import time
|
import time
|
||||||
from weboob.capabilities.messages import ICapMessages, Message, Thread
|
from weboob.capabilities.messages import ICapMessages, Message, Thread
|
||||||
|
from weboob.capabilities.base import find_object
|
||||||
from weboob.tools.backend import BaseBackend
|
from weboob.tools.backend import BaseBackend
|
||||||
from weboob.tools.newsfeed import Newsfeed
|
from weboob.tools.newsfeed import Newsfeed
|
||||||
|
|
||||||
|
|
@ -38,17 +39,12 @@ class GenericNewspaperBackend(BaseBackend, ICapMessages):
|
||||||
URL2ID = None
|
URL2ID = None
|
||||||
RSSSIZE = 0
|
RSSSIZE = 0
|
||||||
|
|
||||||
def _get_thread(self, id):
|
|
||||||
for thread in self.iter_threads():
|
|
||||||
if thread.id == id:
|
|
||||||
return thread
|
|
||||||
|
|
||||||
def get_thread(self, _id):
|
def get_thread(self, _id):
|
||||||
if isinstance(_id, Thread):
|
if isinstance(_id, Thread):
|
||||||
thread = _id
|
thread = _id
|
||||||
id = thread.id
|
id = thread.id
|
||||||
else:
|
else:
|
||||||
thread = self._get_thread(_id)
|
thread = find_object(self.iter_threads(), id=_id)
|
||||||
id = _id
|
id = _id
|
||||||
|
|
||||||
with self.browser:
|
with self.browser:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue