s/BaseBackend/BaseModule

This commit is contained in:
Florent 2014-09-22 17:25:38 +02:00
commit 8559af3d6a
165 changed files with 354 additions and 354 deletions

View file

@ -63,8 +63,8 @@ For example, use this command::
In a module directory, there are commonly these files:
* **__init__.py** - needed in every python modules, it exports your :class:`BaseBackend <weboob.tools.backend.BaseBackend>` class.
* **backend.py** - defines the main class of your module, which derives :class:`BaseBackend <weboob.tools.backend.BaseBackend>`.
* **__init__.py** - needed in every python modules, it exports your :class:`BaseModule <weboob.tools.backend.BaseModule>` class.
* **backend.py** - defines the main class of your module, which derives :class:`BaseModule <weboob.tools.backend.BaseModule>`.
* **browser.py** - your browser, derived from :class:`BaseBrowser <weboob.tools.browser2.browser.BaseBrowser>`, is called by your module to interact with the supported website.
* **pages.py** - all website's pages handled by the browser are defined here
* **test.py** - functional tests
@ -97,9 +97,9 @@ If the last command does not work, check your :doc:`repositories setup </guides/
Backend class
*************
Edit ``backend.py``. It contains the main class of the module derived from :class:`BaseBackend <weboob.tools.backend.BaseBackend>` class::
Edit ``backend.py``. It contains the main class of the module derived from :class:`BaseModule <weboob.tools.backend.BaseModule>` class::
class ExampleBackend(BaseBackend, CapBank):
class ExampleBackend(BaseModule, CapBank):
NAME = 'example' # The name of module
DESCRIPTION = u'Example bank website' # Description of your module
MAINTAINER = u'John Smith' # Name of maintainer of this module
@ -138,7 +138,7 @@ For example::
from weboob.tools.backend import BackendConfig
# ...
class ExampleBackend(BaseBackend, CapBank):
class ExampleBackend(BaseModule, CapBank):
# ...
CONFIG = BackendConfig(Value('username', label='Username', regexp='.+'),
ValueBackendPassword('password', label='Password'),
@ -155,7 +155,7 @@ Implement capabilities
You need to implement each method of all of the capabilities your module implements. For example, in our case::
# ...
class ExampleBackend(BaseBackend, CapBank):
class ExampleBackend(BaseModule, CapBank):
# ...
def iter_accounts(self):
@ -271,7 +271,7 @@ Now you have a functional browser, you can use it in your class ``ExampleBackend
from .browser import ExampleBrowser
# ...
class ExampleBackend(BaseBackend, CapBank):
class ExampleBackend(BaseModule, CapBank):
# ...
BROWSER = ExampleBrowser
@ -288,9 +288,9 @@ Login management
----------------
When the website requires to be authenticated, you have to give credentials to the constructor of the browser. You can redefine
the method :func:`create_default_browser <weboob.tools.backend.BaseBackend.create_default_browser>`::
the method :func:`create_default_browser <weboob.tools.backend.BaseModule.create_default_browser>`::
class ExampleBackend(BaseBackend, CapBank):
class ExampleBackend(BaseModule, CapBank):
# ...
def create_default_browser(self):
return self.create_browser(self.config['username'].get(), self.config['password'].get())
@ -430,8 +430,8 @@ Filling objects
An object returned by a method of a capability can be not fully completed.
The class :class:`BaseBackend <weboob.tools.backend.BaseBackend>` provides a method named
:func:`fillobj <weboob.tools.backend.BaseBackend.fillobj>`, which can be called by an application to
The class :class:`BaseModule <weboob.tools.backend.BaseModule>` provides a method named
:func:`fillobj <weboob.tools.backend.BaseModule.fillobj>`, which can be called by an application to
fill some unloaded fields of a specific object, for example with::
backend.fillobj(video, ['url', 'author'])
@ -443,7 +443,7 @@ uncompleted fields, and call the method associated to the type of the object.
To define what objects are supported to be filled, and what method to call, define the ``OBJECTS``
class attribute in your ``ExampleBackend``::
class ExampleBackend(BaseBackend, CapVideo):
class ExampleBackend(BaseModule, CapVideo):
# ...
OBJECTS = {Video: fill_video}
@ -454,7 +454,7 @@ The prototype of the function might be::
Then, the function might, for each requested fields, fetch the right data and fill the object. For example::
class ExampleBackend(BaseBackend, CapVideo):
class ExampleBackend(BaseModule, CapVideo):
# ...
def fill_video(self, video, fields):
@ -477,7 +477,7 @@ The application can provide a storage to let your backend store data. So, you ca
STORAGE = {'seen': {}}
To store and read data in your storage space, use the ``storage`` attribute of your :class:`BaseBackend <weboob.tools.backend.BaseBackend>`
To store and read data in your storage space, use the ``storage`` attribute of your :class:`BaseModule <weboob.tools.backend.BaseModule>`
object.
It implements the methods of :class:`BackendStorage <weboob.tools.backend.BackendStorage>`.