rename Backend to BaseBackend
This commit is contained in:
parent
e3ad695346
commit
a09658d6cf
11 changed files with 38 additions and 38 deletions
|
|
@ -43,7 +43,7 @@ class BackendStorage(object):
|
|||
if self.storage:
|
||||
return self.storage.save(self.name)
|
||||
|
||||
class Backend(object):
|
||||
class BaseBackend(object):
|
||||
# Module name.
|
||||
NAME = None
|
||||
# Name of the maintainer of this module.
|
||||
|
|
@ -79,10 +79,10 @@ class Backend(object):
|
|||
value = config.get(name, field.default)
|
||||
|
||||
if value is None:
|
||||
raise Backend.ConfigError('Missing parameter "%s" (%s)' % (name, field.description))
|
||||
raise BaseBackend.ConfigError('Missing parameter "%s" (%s)' % (name, field.description))
|
||||
|
||||
if field.regexp and re.match(field.regexp, str(value)):
|
||||
raise Backend.ConfigError('Value of "%s" does not match regexp "%s"' % (name, field.regexp))
|
||||
raise BaseBackend.ConfigError('Value of "%s" does not match regexp "%s"' % (name, field.regexp))
|
||||
|
||||
if not field.default is None:
|
||||
if isinstance(field.default, bool) and not isinstance(value, bool):
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
"""
|
||||
|
||||
from weboob.backend import Backend
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply
|
||||
from weboob.capabilities.dating import ICapDating
|
||||
from weboob.tools.browser import BrowserUnavailable
|
||||
|
|
@ -26,15 +26,15 @@ from weboob.tools.browser import BrowserUnavailable
|
|||
from .adopte import AdopteUnMec
|
||||
from .optim.profiles_walker import ProfilesWalker
|
||||
|
||||
class AuMBackend(Backend, ICapMessages, ICapMessagesReply, ICapDating):
|
||||
class AuMBackend(BaseBackend, ICapMessages, ICapMessagesReply, ICapDating):
|
||||
NAME = 'aum'
|
||||
MAINTAINER = 'Romain Bignon'
|
||||
EMAIL = 'romain@peerfuse.org'
|
||||
VERSION = '1.0'
|
||||
LICENSE = 'GPLv3'
|
||||
DESCRIPTION = "French dating website"
|
||||
CONFIG = {'username': Backend.ConfigField(description='Username on website'),
|
||||
'password': Backend.ConfigField(description='Password of account', is_masked=True),
|
||||
CONFIG = {'username': BaseBackend.ConfigField(description='Username on website'),
|
||||
'password': BaseBackend.ConfigField(description='Password of account', is_masked=True),
|
||||
}
|
||||
STORAGE = {'profiles_walker': {'viewed': []} }
|
||||
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
"""
|
||||
|
||||
from weboob.backend import Backend
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.capabilities.bank import ICapBank, AccountNotFound
|
||||
|
||||
from .browser import BNPorc
|
||||
|
||||
class BNPorcBackend(Backend, ICapBank):
|
||||
class BNPorcBackend(BaseBackend, ICapBank):
|
||||
NAME = 'bnporc'
|
||||
MAINTAINER = 'Romain Bignon'
|
||||
EMAIL = 'romain@peerfuse.org'
|
||||
|
|
@ -31,8 +31,8 @@ class BNPorcBackend(Backend, ICapBank):
|
|||
LICENSE = 'GPLv3'
|
||||
DESCRIPTION = 'BNP Paribas french bank\' website'
|
||||
|
||||
CONFIG = {'login': Backend.ConfigField(description='Account ID'),
|
||||
'password': Backend.ConfigField(description='Password of account', is_masked=True)
|
||||
CONFIG = {'login': BaseBackend.ConfigField(description='Account ID'),
|
||||
'password': BaseBackend.ConfigField(description='Password of account', is_masked=True)
|
||||
}
|
||||
browser = None
|
||||
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
"""
|
||||
|
||||
from weboob.backend import Backend
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.capabilities.travel import ICapTravel, Station, Departure
|
||||
|
||||
from .browser import CanalTP
|
||||
|
||||
class CanalTPBackend(Backend, ICapTravel):
|
||||
class CanalTPBackend(BaseBackend, ICapTravel):
|
||||
NAME = 'canaltp'
|
||||
MAINTAINER = 'Romain Bignon'
|
||||
EMAIL = 'romain@peerfuse.org'
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
"""
|
||||
|
||||
from weboob.backend import Backend
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.capabilities.bank import ICapBank, AccountNotFound
|
||||
|
||||
from .browser import Cragr
|
||||
|
||||
class CragrBackend(Backend, ICapBank):
|
||||
class CragrBackend(BaseBackend, ICapBank):
|
||||
NAME = 'cragr'
|
||||
MAINTAINER = 'Laurent Bachelier'
|
||||
EMAIL = 'laurent@bachelier.name'
|
||||
|
|
@ -31,9 +31,9 @@ class CragrBackend(Backend, ICapBank):
|
|||
DESCRIPTION = 'Credit Agricole french bank\'s website'
|
||||
LICENSE = 'GPLv3'
|
||||
|
||||
CONFIG = {'login': Backend.ConfigField(description='Account ID'),
|
||||
'password': Backend.ConfigField(description='Password of account', is_masked=True),
|
||||
'website': Backend.ConfigField(description='What website to use', default='m.lefil.com'),
|
||||
CONFIG = {'login': BaseBackend.ConfigField(description='Account ID'),
|
||||
'password': BaseBackend.ConfigField(description='Password of account', is_masked=True),
|
||||
'website': BaseBackend.ConfigField(description='What website to use', default='m.lefil.com'),
|
||||
}
|
||||
browser = None
|
||||
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
"""
|
||||
|
||||
from weboob.backend import Backend
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply, Message
|
||||
|
||||
from .feeds import ArticlesList
|
||||
from .browser import DLFP
|
||||
|
||||
class DLFPBackend(Backend, ICapMessages, ICapMessagesReply):
|
||||
class DLFPBackend(BaseBackend, ICapMessages, ICapMessagesReply):
|
||||
NAME = 'dlfp'
|
||||
MAINTAINER = 'Romain Bignon'
|
||||
EMAIL = 'romain@peerfuse.org'
|
||||
|
|
@ -32,10 +32,10 @@ class DLFPBackend(Backend, ICapMessages, ICapMessagesReply):
|
|||
LICENSE = 'GPLv3'
|
||||
DESCRIPTION = "Da Linux French Page"
|
||||
|
||||
CONFIG = {'username': Backend.ConfigField(description='Username on website'),
|
||||
'password': Backend.ConfigField(description='Password of account', is_masked=True),
|
||||
'get_news': Backend.ConfigField(default=True, description='Get newspapers'),
|
||||
'get_telegrams': Backend.ConfigField(default=False, description='Get telegrams'),
|
||||
CONFIG = {'username': BaseBackend.ConfigField(description='Username on website'),
|
||||
'password': BaseBackend.ConfigField(description='Password of account', is_masked=True),
|
||||
'get_news': BaseBackend.ConfigField(default=True, description='Get newspapers'),
|
||||
'get_telegrams': BaseBackend.ConfigField(default=False, description='Get telegrams'),
|
||||
}
|
||||
STORAGE = {'seen': {}}
|
||||
_browser = None
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
"""
|
||||
|
||||
from weboob.backend import Backend
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.capabilities.travel import ICapTravel, Station, Departure
|
||||
|
||||
from .browser import Transilien
|
||||
from .stations import STATIONS
|
||||
|
||||
class TransilienBackend(Backend, ICapTravel):
|
||||
class TransilienBackend(BaseBackend, ICapTravel):
|
||||
NAME = 'transilien'
|
||||
MAINTAINER = u'Julien Hébert'
|
||||
EMAIL = 'juke@free.fr'
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
"""
|
||||
|
||||
from weboob.backend import Backend
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.capabilities.video import ICapVideoProvider
|
||||
|
||||
from .browser import YoujizzBrowser
|
||||
|
||||
class YoujizzBackend(Backend, ICapVideoProvider):
|
||||
class YoujizzBackend(BaseBackend, ICapVideoProvider):
|
||||
NAME = 'youjizz'
|
||||
MAINTAINER = 'Roger Philibert'
|
||||
EMAIL = 'roger.philibert@gmail.com'
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
"""
|
||||
|
||||
from weboob.backend import Backend
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.capabilities.video import ICapVideoProvider
|
||||
|
||||
from .browser import YoutubeBrowser
|
||||
|
||||
class YoutubeBackend(Backend, ICapVideoProvider):
|
||||
class YoutubeBackend(BaseBackend, ICapVideoProvider):
|
||||
NAME = 'youtube'
|
||||
MAINTAINER = 'Christophe Benz'
|
||||
EMAIL = 'christophe.benz@gmail.com'
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ import urllib2
|
|||
from xml.dom import minidom
|
||||
|
||||
# TODO store datetime objects instead of strings
|
||||
from datetime import datetime
|
||||
# from datetime import datetime
|
||||
|
||||
from weboob.backend import Backend
|
||||
from weboob.capabilities.weather import ICapWeather, CityNotFound, City, Current, Forecast
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.capabilities.weather import ICapWeather, CityNotFound, Current, Forecast
|
||||
|
||||
class YWeatherBackend(Backend, ICapWeather):
|
||||
class YWeatherBackend(BaseBackend, ICapWeather):
|
||||
NAME = 'yweather'
|
||||
MAINTAINER = 'Romain Bignon'
|
||||
EMAIL = 'romain@peerfuse.org'
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ import stat
|
|||
from ConfigParser import SafeConfigParser
|
||||
from logging import warning, debug
|
||||
|
||||
import weboob.backends as backends
|
||||
from weboob.backend import Backend
|
||||
import weboob.backends
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.capabilities.cap import ICap
|
||||
|
||||
class Module:
|
||||
|
|
@ -37,11 +37,11 @@ class Module:
|
|||
self.klass = None
|
||||
for attrname in dir(self.module):
|
||||
attr = getattr(self.module, attrname)
|
||||
if isinstance(attr, type) and issubclass(attr, Backend) and attr != Backend:
|
||||
if isinstance(attr, type) and issubclass(attr, BaseBackend) and attr != BaseBackend:
|
||||
self.klass = attr
|
||||
|
||||
if not self.klass:
|
||||
raise ImportError("This is not a backend module (no Backend class found)")
|
||||
raise ImportError("This is not a backend module (no BaseBackend class found)")
|
||||
|
||||
def get_name(self):
|
||||
return self.klass.NAME
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue