This commit is contained in:
Romain Bignon 2010-07-13 18:47:31 +02:00
commit ca7d37e3cb
7 changed files with 17 additions and 17 deletions

View file

@ -55,8 +55,8 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesReply, ICapDating, ICapC
} }
BROWSER = AuMBrowser BROWSER = AuMBrowser
def default_browser(self): def create_default_browser(self):
return self.build_browser(self.config['username'], self.config['password']) return self.create_browser(self.config['username'], self.config['password'])
def get_status(self): def get_status(self):
with self.browser: with self.browser:

View file

@ -36,8 +36,8 @@ class BNPorcBackend(BaseBackend, ICapBank):
} }
BROWSER = BNPorc BROWSER = BNPorc
def default_browser(self): def create_default_browser(self):
return self.build_browser(self.config['login'], self.config['password']) return self.create_browser(self.config['login'], self.config['password'])
def iter_accounts(self): def iter_accounts(self):
for account in self.browser.get_accounts_list(): for account in self.browser.get_accounts_list():

View file

@ -35,8 +35,8 @@ class CragrBackend(BaseBackend, ICapBank):
} }
BROWSER = Cragr BROWSER = Cragr
def default_browser(self): def create_default_browser(self):
return self.build_browser(self.config['website'], self.config['login'], self.config['password']) return self.create_browser(self.config['website'], self.config['login'], self.config['password'])
def iter_accounts(self): def iter_accounts(self):
for account in self.browser.get_accounts_list(): for account in self.browser.get_accounts_list():

View file

@ -44,8 +44,8 @@ class DLFPBackend(BaseBackend, ICapMessages, ICapMessagesReply):
STORAGE = {'seen': {}} STORAGE = {'seen': {}}
BROWSER = DLFP BROWSER = DLFP
def default_browser(self): def create_default_browser(self):
return self.build_browser(self.config['username'], self.config['password']) return self.create_browser(self.config['username'], self.config['password'])
def iter_messages(self, thread=None): def iter_messages(self, thread=None):
return self._iter_messages(thread, False) return self._iter_messages(thread, False)

View file

@ -40,9 +40,9 @@ class GazelleBackend(BaseBackend, ICapTorrent):
} }
BROWSER = GazelleBrowser BROWSER = GazelleBrowser
def default_browser(self): def create_default_browser(self):
return self.build_browser(self.config['protocol'], self.config['domain'], return self.create_browser(self.config['protocol'], self.config['domain'],
self.config['username'], self.config['password']) self.config['username'], self.config['password'])
def get_torrent(self, id): def get_torrent(self, id):
return self.browser.get_torrent(id) return self.browser.get_torrent(id)

View file

@ -18,7 +18,7 @@
import sys import sys
if sys.version_info[:2] <= (2, 5): if sys.version_info[:2] <= (2, 5):
import weboob.tools.property from weboob.tools import property
from .cap import ICap from .cap import ICap

View file

@ -127,20 +127,20 @@ class BaseBackend(object):
Attribute 'browser'. The browser is created at the first call Attribute 'browser'. The browser is created at the first call
of this attribute, to avoid useless pages access. of this attribute, to avoid useless pages access.
Note that the 'default_browser' method is called to create it. Note that the 'create_default_browser' method is called to create it.
""" """
if not hasattr(self, '_browser'): if not hasattr(self, '_browser'):
self._browser = self.default_browser() self._browser = self.create_default_browser()
return self._browser return self._browser
def default_browser(self): def create_default_browser(self):
""" """
Method to overload to build the default browser in Method to overload to build the default browser in
attribute 'browser'. attribute 'browser'.
""" """
return self.build_browser() return self.create_browser()
def build_browser(self, *args, **kwargs): def create_browser(self, *args, **kwargs):
""" """
Build a browser from the BROWSER class attribute and the Build a browser from the BROWSER class attribute and the
given arguments. given arguments.