rename CapBaseObject to BaseObject (refs #1424)

This commit is contained in:
Romain Bignon 2014-07-05 17:26:05 +02:00
commit 51958135cb
44 changed files with 183 additions and 183 deletions

View file

@ -13,7 +13,7 @@ Prefer returning objects
Python is an object-oriented language, so when your capability supports entities (for example Python is an object-oriented language, so when your capability supports entities (for example
:class:`weboob.capabilities.video.BaseVideo` with the :class:`weboob.capabilities.video.ICapVideo` capability), :class:`weboob.capabilities.video.BaseVideo` with the :class:`weboob.capabilities.video.ICapVideo` capability),
you have to create a class derived from :class:`weboob.capabilities.base.CapBaseObject`, and create an unique method you have to create a class derived from :class:`weboob.capabilities.base.BaseObject`, and create an unique method
to get it (for example :func:`get_video() <weboob.capabilities.video.ICapVideo.get_video>`), instead of several methods like to get it (for example :func:`get_video() <weboob.capabilities.video.ICapVideo.get_video>`), instead of several methods like
``get_video_url()``, ``get_video_preview()``, etc. ``get_video_url()``, ``get_video_preview()``, etc.

View file

@ -26,7 +26,7 @@ import urllib
from weboob.tools.browser2.page import HTMLPage, JsonPage, method, ListElement, ItemElement, FormNotFound, pagination from weboob.tools.browser2.page import HTMLPage, JsonPage, method, ListElement, ItemElement, FormNotFound, pagination
from weboob.tools.browser2.filters import CleanText, Format, Link, Regexp, Env, DateTime, Attr, Filter from weboob.tools.browser2.filters import CleanText, Format, Link, Regexp, Env, DateTime, Attr, Filter
from weboob.capabilities.messages import Thread, Message from weboob.capabilities.messages import Thread, Message
from weboob.capabilities.base import CapBaseObject from weboob.capabilities.base import BaseObject
__all__ = ['LoginPage', 'LoginErrorPage', 'ThreadPage', 'Tweet', 'TrendsPage', 'TimelinePage', 'HomeTimelinePage', 'SearchTimelinePage'] __all__ = ['LoginPage', 'LoginErrorPage', 'ThreadPage', 'Tweet', 'TrendsPage', 'TimelinePage', 'HomeTimelinePage', 'SearchTimelinePage']
@ -118,7 +118,7 @@ class TrendsPage(TwitterJsonHTMLPage):
item_xpath = '//li[@class="trend-item js-trend-item "]' item_xpath = '//li[@class="trend-item js-trend-item "]'
class item(ItemElement): class item(ItemElement):
klass = CapBaseObject klass = BaseObject
obj_id = Attr('.', 'data-trend-name') obj_id = Attr('.', 'data-trend-name')

View file

@ -20,7 +20,7 @@
import itertools import itertools
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
from weboob.tools.test import BackendTest from weboob.tools.test import BackendTest
from weboob.capabilities.base import CapBaseObject from weboob.capabilities.base import BaseObject
class TwitterTest(BackendTest): class TwitterTest(BackendTest):
@ -43,7 +43,7 @@ class TwitterTest(BackendTest):
def test_ls_me(self): def test_ls_me(self):
if self.backend.browser.username: if self.backend.browser.username:
l = list(itertools.islice(self.backend.iter_resources([CapBaseObject], ['me']), 0 ,20)) l = list(itertools.islice(self.backend.iter_resources([BaseObject], ['me']), 0 ,20))
assert len(l) assert len(l)
thread = self.backend.get_thread(l[0].id) thread = self.backend.get_thread(l[0].id)
assert len(thread.root.content) assert len(thread.root.content)
@ -51,27 +51,27 @@ class TwitterTest(BackendTest):
raise SkipTest("User credentials not defined") raise SkipTest("User credentials not defined")
def test_ls_search(self): def test_ls_search(self):
l = list(itertools.islice(self.backend.iter_resources([CapBaseObject], ['search', 'weboob']), 0 ,20)) l = list(itertools.islice(self.backend.iter_resources([BaseObject], ['search', 'weboob']), 0 ,20))
assert len(l) assert len(l)
thread = self.backend.get_thread(l[0].id) thread = self.backend.get_thread(l[0].id)
assert len(thread.root.content) assert len(thread.root.content)
def test_ls_hashtag(self): def test_ls_hashtag(self):
l = list(itertools.islice(self.backend.iter_resources([CapBaseObject], ['hashtags', 'weboob']), 0 ,20)) l = list(itertools.islice(self.backend.iter_resources([BaseObject], ['hashtags', 'weboob']), 0 ,20))
assert len(l) assert len(l)
thread = self.backend.get_thread(l[0].id) thread = self.backend.get_thread(l[0].id)
assert len(thread.root.content) assert len(thread.root.content)
def test_ls_profils(self): def test_ls_profils(self):
l = list(itertools.islice(self.backend.iter_resources([CapBaseObject], ['profils', 'jf_cope']), 0 ,20)) l = list(itertools.islice(self.backend.iter_resources([BaseObject], ['profils', 'jf_cope']), 0 ,20))
assert len(l) assert len(l)
thread = self.backend.get_thread(l[0].id) thread = self.backend.get_thread(l[0].id)
assert len(thread.root.content) assert len(thread.root.content)
def test_ls_trend(self): def test_ls_trend(self):
l = list(self.backend.iter_resources([CapBaseObject], ['trendy'])) l = list(self.backend.iter_resources([BaseObject], ['trendy']))
assert len(l) assert len(l)
l1 = list(itertools.islice(self.backend.iter_resources([CapBaseObject], ['trendy', u'%s' % l[0].split_path[0]]), 0 ,20)) l1 = list(itertools.islice(self.backend.iter_resources([BaseObject], ['trendy', u'%s' % l[0].split_path[0]]), 0 ,20))
assert len(l1) assert len(l1)
thread = self.backend.get_thread(l1[0].id) thread = self.backend.get_thread(l1[0].id)
assert len(thread.root.content) assert len(thread.root.content)

View file

@ -28,7 +28,7 @@ import os
import re import re
import unicodedata import unicodedata
from weboob.capabilities.base import empty, CapBaseObject from weboob.capabilities.base import empty, BaseObject
from weboob.capabilities.bugtracker import ICapBugTracker, Query, Update, Project, Issue, IssueError from weboob.capabilities.bugtracker import ICapBugTracker, Query, Update, Project, Issue, IssueError
from weboob.tools.application.repl import ReplApplication, defaultcount from weboob.tools.application.repl import ReplApplication, defaultcount
from weboob.tools.application.formatters.iformatter import IFormatter, PrettyFormatter from weboob.tools.application.formatters.iformatter import IFormatter, PrettyFormatter
@ -47,7 +47,7 @@ class IssueFormatter(IFormatter):
return u'' return u''
value = getattr(obj, attr) value = getattr(obj, attr)
if isinstance(value, CapBaseObject): if isinstance(value, BaseObject):
value = value.name value = value.name
return self.format_key(attr.capitalize(), value) return self.format_key(attr.capitalize(), value)

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from .base import UserError, NotLoaded, NotAvailable, CapBaseObject, IBaseCap from .base import UserError, NotLoaded, NotAvailable, BaseObject, IBaseCap
__all__ = ['UserError', 'NotLoaded', 'NotAvailable', 'CapBaseObject', 'IBaseCap'] __all__ = ['UserError', 'NotLoaded', 'NotAvailable', 'BaseObject', 'IBaseCap']

View file

@ -18,7 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from .base import IBaseCap, CapBaseObject, StringField, Field, UserError from .base import IBaseCap, BaseObject, StringField, Field, UserError
__all__ = ['AccountRegisterError', 'Account', 'StatusField', 'ICapAccount'] __all__ = ['AccountRegisterError', 'Account', 'StatusField', 'ICapAccount']
@ -30,7 +30,7 @@ class AccountRegisterError(UserError):
""" """
class Account(CapBaseObject): class Account(BaseObject):
""" """
Describe an account and its properties. Describe an account and its properties.
""" """
@ -39,7 +39,7 @@ class Account(CapBaseObject):
properties = Field('List of key/value properties', dict) properties = Field('List of key/value properties', dict)
def __init__(self, id=None): def __init__(self, id=None):
CapBaseObject.__init__(self, id) BaseObject.__init__(self, id)
class StatusField(object): class StatusField(object):

View file

@ -22,7 +22,7 @@ import re
from datetime import timedelta from datetime import timedelta
from .image import BaseImage from .image import BaseImage
from .base import Field, StringField, IntField, CapBaseObject from .base import Field, StringField, IntField, BaseObject
from .file import ICapFile, BaseFile from .file import ICapFile, BaseFile
@ -44,7 +44,7 @@ def decode_id(decode_id):
return wrapper return wrapper
class Album(CapBaseObject): class Album(BaseObject):
""" """
Represent an album Represent an album
""" """
@ -55,7 +55,7 @@ class Album(CapBaseObject):
tracks_list = Field('list of tracks', list) tracks_list = Field('list of tracks', list)
def __init__(self, _id): def __init__(self, _id):
CapBaseObject.__init__(self, unicode("album.%s" % _id)) BaseObject.__init__(self, unicode("album.%s" % _id))
@classmethod @classmethod
def decode_id(cls, _id): def decode_id(cls, _id):
@ -66,7 +66,7 @@ class Album(CapBaseObject):
return _id return _id
class Playlist(CapBaseObject): class Playlist(BaseObject):
""" """
Represent a playlist Represent a playlist
""" """
@ -74,7 +74,7 @@ class Playlist(CapBaseObject):
tracks_list = Field('list of tracks', list) tracks_list = Field('list of tracks', list)
def __init__(self, _id): def __init__(self, _id):
CapBaseObject.__init__(self, unicode("playlist.%s" % _id)) BaseObject.__init__(self, unicode("playlist.%s" % _id))
@classmethod @classmethod
def decode_id(cls, _id): def decode_id(cls, _id):

View file

@ -24,7 +24,7 @@ import re
from weboob.tools.compat import basestring, long from weboob.tools.compat import basestring, long
from .base import CapBaseObject, Field, StringField, DateField, DecimalField, IntField, UserError, Currency from .base import BaseObject, Field, StringField, DateField, DecimalField, IntField, UserError, Currency
from .collection import ICapCollection from .collection import ICapCollection
@ -46,7 +46,7 @@ class TransferError(UserError):
""" """
class Recipient(CapBaseObject, Currency): class Recipient(BaseObject, Currency):
""" """
Recipient of a transfer. Recipient of a transfer.
""" """
@ -55,7 +55,7 @@ class Recipient(CapBaseObject, Currency):
currency = StringField('Currency', default=None) currency = StringField('Currency', default=None)
def __init__(self): def __init__(self):
CapBaseObject.__init__(self, 0) BaseObject.__init__(self, 0)
@property @property
def currency_text(self): def currency_text(self):
@ -86,7 +86,7 @@ class Account(Recipient):
return u"<Account id=%r label=%r>" % (self.id, self.label) return u"<Account id=%r label=%r>" % (self.id, self.label)
class Transaction(CapBaseObject): class Transaction(BaseObject):
""" """
Bank transaction. Bank transaction.
""" """
@ -131,7 +131,7 @@ class Transaction(CapBaseObject):
return "%08x" % (crc & 0xffffffff) return "%08x" % (crc & 0xffffffff)
class Investment(CapBaseObject): class Investment(BaseObject):
""" """
Investment in a financial market. Investment in a financial market.
""" """
@ -145,7 +145,7 @@ class Investment(CapBaseObject):
diff = DecimalField('Difference between the buy cost and the current valuation') diff = DecimalField('Difference between the buy cost and the current valuation')
class Transfer(CapBaseObject): class Transfer(BaseObject):
""" """
Transfer from an account to a recipient. Transfer from an account to a recipient.
""" """
@ -169,7 +169,7 @@ class ICapBank(ICapCollection):
all accounts (by calling :func:`iter_accounts`). all accounts (by calling :func:`iter_accounts`).
:param objs: type of objects to get :param objs: type of objects to get
:type objs: tuple[:class:`CapBaseObject`] :type objs: tuple[:class:`BaseObject`]
:param split_path: path to discover :param split_path: path to discover
:type split_path: :class:`list` :type split_path: :class:`list`
:rtype: iter[:class:`BaseCapObject`] :rtype: iter[:class:`BaseCapObject`]

View file

@ -33,7 +33,7 @@ from weboob.tools.ordereddict import OrderedDict
__all__ = ['UserError', 'FieldNotFound', 'NotAvailable', __all__ = ['UserError', 'FieldNotFound', 'NotAvailable',
'NotLoaded', 'IBaseCap', 'Field', 'IntField', 'DecimalField', 'NotLoaded', 'IBaseCap', 'Field', 'IntField', 'DecimalField',
'FloatField', 'StringField', 'BytesField', 'DateField', 'FloatField', 'StringField', 'BytesField', 'DateField',
'DeltaField', 'empty', 'CapBaseObject'] 'DeltaField', 'empty', 'BaseObject']
def empty(value): def empty(value):
@ -76,7 +76,7 @@ class FieldNotFound(Exception):
A field isn't found. A field isn't found.
:param obj: object :param obj: object
:type obj: :class:`CapBaseObject` :type obj: :class:`BaseObject`
:param field: field not found :param field: field not found
:type field: :class:`Field` :type field: :class:`Field`
""" """
@ -126,7 +126,7 @@ class NotLoadedType(object):
""" """
NotLoaded is a constant to use on not loaded fields. NotLoaded is a constant to use on not loaded fields.
When you use :func:`weboob.tools.backend.BaseBackend.fillobj` on a object based on :class:`CapBaseObject`, When you use :func:`weboob.tools.backend.BaseBackend.fillobj` on a object based on :class:`BaseObject`,
it will request all fields with this value. it will request all fields with this value.
""" """
@ -155,13 +155,13 @@ class IBaseCap(object):
A capability may define abstract methods (which raise :class:`NotImplementedError`) A capability may define abstract methods (which raise :class:`NotImplementedError`)
with an explicit docstring to tell backends how to implement them. with an explicit docstring to tell backends how to implement them.
Also, it may define some *objects*, using :class:`CapBaseObject`. Also, it may define some *objects*, using :class:`BaseObject`.
""" """
class Field(object): class Field(object):
""" """
Field of a :class:`CapBaseObject` class. Field of a :class:`BaseObject` class.
:param doc: docstring of the field :param doc: docstring of the field
:type doc: :class:`str` :type doc: :class:`str`
@ -284,12 +284,12 @@ class DeltaField(Field):
Field.__init__(self, doc, datetime.timedelta, **kwargs) Field.__init__(self, doc, datetime.timedelta, **kwargs)
class _CapBaseObjectMeta(type): class _BaseObjectMeta(type):
def __new__(cls, name, bases, attrs): def __new__(cls, name, bases, attrs):
fields = [(field_name, attrs.pop(field_name)) for field_name, obj in attrs.items() if isinstance(obj, Field)] fields = [(field_name, attrs.pop(field_name)) for field_name, obj in attrs.items() if isinstance(obj, Field)]
fields.sort(key=lambda x: x[1]._creation_counter) fields.sort(key=lambda x: x[1]._creation_counter)
new_class = super(_CapBaseObjectMeta, cls).__new__(cls, name, bases, attrs) new_class = super(_BaseObjectMeta, cls).__new__(cls, name, bases, attrs)
if new_class._fields is None: if new_class._fields is None:
new_class._fields = OrderedDict() new_class._fields = OrderedDict()
else: else:
@ -306,7 +306,7 @@ class _CapBaseObjectMeta(type):
return new_class return new_class
class CapBaseObject(object): class BaseObject(object):
""" """
This is the base class for a capability object. This is the base class for a capability object.
@ -319,7 +319,7 @@ class CapBaseObject(object):
For example:: For example::
class Transfer(CapBaseObject): class Transfer(BaseObject):
" Transfer from an account to a recipient. " " Transfer from an account to a recipient. "
amount = DecimalField('Amount to transfer') amount = DecimalField('Amount to transfer')
@ -330,7 +330,7 @@ class CapBaseObject(object):
The docstring is mandatory. The docstring is mandatory.
""" """
__metaclass__ = _CapBaseObjectMeta __metaclass__ = _BaseObjectMeta
id = None id = None
backend = None backend = None
@ -394,7 +394,7 @@ class CapBaseObject(object):
yield name, field.value yield name, field.value
def __eq__(self, obj): def __eq__(self, obj):
if isinstance(obj, CapBaseObject): if isinstance(obj, BaseObject):
return self.backend == obj.backend and self.id == obj.id return self.backend == obj.backend and self.id == obj.id
else: else:
return False return False

View file

@ -18,7 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from .base import CapBaseObject, StringField, DateField, DecimalField, UserError from .base import BaseObject, StringField, DateField, DecimalField, UserError
from .collection import ICapCollection from .collection import ICapCollection
@ -41,7 +41,7 @@ class BillNotFound(UserError):
UserError.__init__(self, msg) UserError.__init__(self, msg)
class Detail(CapBaseObject): class Detail(BaseObject):
""" """
Detail of a subscription Detail of a subscription
""" """
@ -55,10 +55,10 @@ class Detail(CapBaseObject):
unit = StringField('Unit of the consumption') unit = StringField('Unit of the consumption')
def __init__(self): def __init__(self):
CapBaseObject.__init__(self, 0) BaseObject.__init__(self, 0)
class Bill(CapBaseObject): class Bill(BaseObject):
""" """
Bill. Bill.
""" """
@ -73,10 +73,10 @@ class Bill(CapBaseObject):
finishdate = DateField('The last day the bill applies to') finishdate = DateField('The last day the bill applies to')
def __init__(self): def __init__(self):
CapBaseObject.__init__(self, 0) BaseObject.__init__(self, 0)
class Subscription(CapBaseObject): class Subscription(BaseObject):
""" """
Subscription to a service. Subscription to a service.
""" """

View file

@ -18,7 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from .base import IBaseCap, CapBaseObject, Field, StringField, DateField, \ from .base import IBaseCap, BaseObject, Field, StringField, DateField, \
IntField, DeltaField, UserError IntField, DeltaField, UserError
@ -32,7 +32,7 @@ class IssueError(UserError):
""" """
class Project(CapBaseObject): class Project(BaseObject):
""" """
Represents a project. Represents a project.
""" """
@ -45,7 +45,7 @@ class Project(CapBaseObject):
priorities = Field('Available priorities for issues', list) priorities = Field('Available priorities for issues', list)
def __init__(self, id, name): def __init__(self, id, name):
CapBaseObject.__init__(self, id) BaseObject.__init__(self, id)
self.name = unicode(name) self.name = unicode(name)
def __repr__(self): def __repr__(self):
@ -105,35 +105,35 @@ class Project(CapBaseObject):
return None return None
class User(CapBaseObject): class User(BaseObject):
""" """
User. User.
""" """
name = StringField('Name of user') name = StringField('Name of user')
def __init__(self, id, name): def __init__(self, id, name):
CapBaseObject.__init__(self, id) BaseObject.__init__(self, id)
self.name = unicode(name) self.name = unicode(name)
def __repr__(self): def __repr__(self):
return '<User %r>' % self.name return '<User %r>' % self.name
class Version(CapBaseObject): class Version(BaseObject):
""" """
Version of a project. Version of a project.
""" """
name = StringField('Name of version') name = StringField('Name of version')
def __init__(self, id, name): def __init__(self, id, name):
CapBaseObject.__init__(self, id) BaseObject.__init__(self, id)
self.name = unicode(name) self.name = unicode(name)
def __repr__(self): def __repr__(self):
return '<Version %r>' % self.name return '<Version %r>' % self.name
class Status(CapBaseObject): class Status(BaseObject):
""" """
Status of an issue. Status of an issue.
@ -149,7 +149,7 @@ class Status(CapBaseObject):
value = IntField('Value of status (constants VALUE_*)') value = IntField('Value of status (constants VALUE_*)')
def __init__(self, id, name, value): def __init__(self, id, name, value):
CapBaseObject.__init__(self, id) BaseObject.__init__(self, id)
self.name = unicode(name) self.name = unicode(name)
self.value = value self.value = value
@ -157,7 +157,7 @@ class Status(CapBaseObject):
return '<Status %r>' % self.name return '<Status %r>' % self.name
class Attachment(CapBaseObject): class Attachment(BaseObject):
""" """
Attachment of an issue. Attachment of an issue.
""" """
@ -168,7 +168,7 @@ class Attachment(CapBaseObject):
return '<Attachment %r>' % self.filename return '<Attachment %r>' % self.filename
class Change(CapBaseObject): class Change(BaseObject):
""" """
A change of an update. A change of an update.
""" """
@ -177,7 +177,7 @@ class Change(CapBaseObject):
new = StringField('New value of field') new = StringField('New value of field')
class Update(CapBaseObject): class Update(BaseObject):
""" """
Represents an update of an issue. Represents an update of an issue.
""" """
@ -192,7 +192,7 @@ class Update(CapBaseObject):
return '<Update %r>' % self.id return '<Update %r>' % self.id
class Issue(CapBaseObject): class Issue(BaseObject):
""" """
Represents an issue. Represents an issue.
""" """
@ -215,7 +215,7 @@ class Issue(CapBaseObject):
priority = StringField('Priority of the issue') #XXX priority = StringField('Priority of the issue') #XXX
class Query(CapBaseObject): class Query(BaseObject):
""" """
Query to find an issue. Query to find an issue.
""" """
@ -228,7 +228,7 @@ class Query(CapBaseObject):
status = StringField('Filter on statuses') status = StringField('Filter on statuses')
def __init__(self): def __init__(self):
CapBaseObject.__init__(self, '') BaseObject.__init__(self, '')
class ICapBugTracker(IBaseCap): class ICapBugTracker(IBaseCap):

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from .base import CapBaseObject, StringField, DateField, IntField, FloatField, Field from .base import BaseObject, StringField, DateField, IntField, FloatField, Field
from .collection import ICapCollection, CollectionNotFound, Collection from .collection import ICapCollection, CollectionNotFound, Collection
from datetime import time, datetime from datetime import time, datetime
@ -45,7 +45,7 @@ TRANSP = enum(OPAQUE=u'OPAQUE', TRANSPARENT=u'TRANSPARENT')
STATUS = enum(TENTATIVE=u'TENTATIVE', CONFIRMED=u'CONFIRMED', CANCELLED=u'CANCELLED') STATUS = enum(TENTATIVE=u'TENTATIVE', CONFIRMED=u'CONFIRMED', CANCELLED=u'CANCELLED')
class BaseCalendarEvent(CapBaseObject): class BaseCalendarEvent(BaseObject):
""" """
Represents a calendar event Represents a calendar event
""" """
@ -85,7 +85,7 @@ class BaseCalendarEvent(CapBaseObject):
return self.id2url(self.id) return self.id2url(self.id)
class Query(CapBaseObject): class Query(BaseObject):
""" """
Query to find events Query to find events
""" """
@ -96,7 +96,7 @@ class Query(CapBaseObject):
categories = Field('List of categories of the event', list, tuple) categories = Field('List of categories of the event', list, tuple)
def __init__(self): def __init__(self):
CapBaseObject.__init__(self, '') BaseObject.__init__(self, '')
self.categories = [] self.categories = []
for value in CATEGORIES.values: for value in CATEGORIES.values:
self.categories.append(value) self.categories.append(value)

View file

@ -20,7 +20,7 @@
import datetime import datetime
from .base import IBaseCap, CapBaseObject, StringField, DateField, UserError from .base import IBaseCap, BaseObject, StringField, DateField, UserError
__all__ = ['ChatException', 'ChatMessage', 'ICapChat'] __all__ = ['ChatException', 'ChatMessage', 'ICapChat']
@ -32,7 +32,7 @@ class ChatException(UserError):
""" """
class ChatMessage(CapBaseObject): class ChatMessage(BaseObject):
""" """
Message on the chat. Message on the chat.
""" """
@ -42,7 +42,7 @@ class ChatMessage(CapBaseObject):
date = DateField('Date when the message has been sent') date = DateField('Date when the message has been sent')
def __init__(self, id_from, id_to, message, date=None): def __init__(self, id_from, id_to, message, date=None):
CapBaseObject.__init__(self, '%s.%s' % (id_from, id_to)) BaseObject.__init__(self, '%s.%s' % (id_from, id_to))
self.id_from = id_from self.id_from = id_from
self.id_to = id_to self.id_to = id_to
self.message = message self.message = message

View file

@ -18,13 +18,13 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from .base import IBaseCap, CapBaseObject, DateField, StringField, IntField, Field from .base import IBaseCap, BaseObject, DateField, StringField, IntField, Field
__all__ = ['Movie', 'Person', 'ICapCinema'] __all__ = ['Movie', 'Person', 'ICapCinema']
class Movie(CapBaseObject): class Movie(BaseObject):
""" """
Movie object. Movie object.
""" """
@ -42,11 +42,11 @@ class Movie(CapBaseObject):
thumbnail_url = StringField('Url of movie thumbnail') thumbnail_url = StringField('Url of movie thumbnail')
def __init__(self, id, original_title): def __init__(self, id, original_title):
CapBaseObject.__init__(self, id) BaseObject.__init__(self, id)
self.original_title = original_title self.original_title = original_title
class Person(CapBaseObject): class Person(BaseObject):
""" """
Person object. Person object.
""" """
@ -64,7 +64,7 @@ class Person(CapBaseObject):
thumbnail_url = StringField('Url of person thumbnail') thumbnail_url = StringField('Url of person thumbnail')
def __init__(self, id, name): def __init__(self, id, name):
CapBaseObject.__init__(self, id) BaseObject.__init__(self, id)
self.name = name self.name = name

View file

@ -19,7 +19,7 @@
from weboob.tools.ordereddict import OrderedDict from weboob.tools.ordereddict import OrderedDict
from .base import IBaseCap, CapBaseObject, UserError, StringField, Field from .base import IBaseCap, BaseObject, UserError, StringField, Field
__all__ = ['ICapCollection', 'BaseCollection', 'Collection', 'CollectionNotFound'] __all__ = ['ICapCollection', 'BaseCollection', 'Collection', 'CollectionNotFound']
@ -34,13 +34,13 @@ class CollectionNotFound(UserError):
UserError.__init__(self, msg) UserError.__init__(self, msg)
class BaseCollection(CapBaseObject): class BaseCollection(BaseObject):
""" """
Inherit from this if you want to create an object that is *also* a Collection. Inherit from this if you want to create an object that is *also* a Collection.
However, this probably will not work properly for now. However, this probably will not work properly for now.
""" """
def __init__(self, split_path): def __init__(self, split_path):
CapBaseObject.__init__(self, None) BaseObject.__init__(self, None)
self.split_path = split_path self.split_path = split_path
@property @property
@ -76,7 +76,7 @@ class Collection(BaseCollection):
It is a dumb object, it must not contain callbacks to a backend. It is a dumb object, it must not contain callbacks to a backend.
Do not inherit from this class if you want to make a regular CapBaseObject Do not inherit from this class if you want to make a regular BaseObject
a Collection, use BaseCollection instead. a Collection, use BaseCollection instead.
""" """
title = StringField('Collection title') title = StringField('Collection title')

View file

@ -18,7 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from .base import IBaseCap, CapBaseObject, Field, StringField, BytesField, IntField, \ from .base import IBaseCap, BaseObject, Field, StringField, BytesField, IntField, \
UserError UserError
from weboob.tools.ordereddict import OrderedDict from weboob.tools.ordereddict import OrderedDict
@ -44,7 +44,7 @@ class ProfileNode(object):
return self.value[key] return self.value[key]
class ContactPhoto(CapBaseObject): class ContactPhoto(BaseObject):
""" """
Photo of a contact. Photo of a contact.
""" """
@ -56,7 +56,7 @@ class ContactPhoto(CapBaseObject):
hidden = Field('True if the photo is hidden on website', bool) hidden = Field('True if the photo is hidden on website', bool)
def __init__(self, name): def __init__(self, name):
CapBaseObject.__init__(self, name) BaseObject.__init__(self, name)
self.name = name self.name = name
def __iscomplete__(self): def __iscomplete__(self):
@ -71,7 +71,7 @@ class ContactPhoto(CapBaseObject):
len(self.thumbnail_data) if self.thumbnail_data else 0) len(self.thumbnail_data) if self.thumbnail_data else 0)
class Contact(CapBaseObject): class Contact(BaseObject):
""" """
A contact. A contact.
""" """
@ -89,7 +89,7 @@ class Contact(CapBaseObject):
profile = Field('Contact profile', dict) profile = Field('Contact profile', dict)
def __init__(self, id, name, status): def __init__(self, id, name, status):
CapBaseObject.__init__(self, id) BaseObject.__init__(self, id)
self.name = name self.name = name
self.status = status self.status = status
@ -154,14 +154,14 @@ class QueryError(UserError):
""" """
class Query(CapBaseObject): class Query(BaseObject):
""" """
Query to send to a contact. Query to send to a contact.
""" """
message = StringField('Message received') message = StringField('Message received')
def __init__(self, id, message): def __init__(self, id, message):
CapBaseObject.__init__(self, id) BaseObject.__init__(self, id)
self.message = message self.message = message

View file

@ -18,13 +18,13 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from .base import IBaseCap, CapBaseObject, StringField, DateField, Field from .base import IBaseCap, BaseObject, StringField, DateField, Field
__all__ = ['Content', 'Revision', 'ICapContent'] __all__ = ['Content', 'Revision', 'ICapContent']
class Content(CapBaseObject): class Content(BaseObject):
""" """
Content object. Content object.
""" """
@ -34,7 +34,7 @@ class Content(CapBaseObject):
revision = StringField('ID of revision') revision = StringField('ID of revision')
class Revision(CapBaseObject): class Revision(BaseObject):
""" """
Revision of a change on a content. Revision of a change on a content.
""" """

View file

@ -18,7 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from .base import IBaseCap, CapBaseObject, Field, StringField, DateField, UserError from .base import IBaseCap, BaseObject, Field, StringField, DateField, UserError
from .contact import Contact from .contact import Contact
@ -79,7 +79,7 @@ class Optimization(object):
raise NotImplementedError() raise NotImplementedError()
class Event(CapBaseObject): class Event(BaseObject):
""" """
A dating event (for example a visite, a query received, etc.) A dating event (for example a visite, a query received, etc.)
""" """

View file

@ -18,13 +18,13 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from .base import IBaseCap, CapBaseObject, NotAvailable, Field, StringField, DateField from .base import IBaseCap, BaseObject, NotAvailable, Field, StringField, DateField
__all__ = ['BaseFile', 'ICapFile'] __all__ = ['BaseFile', 'ICapFile']
class BaseFile(CapBaseObject): class BaseFile(BaseObject):
""" """
Represent a file. Represent a file.
""" """

View file

@ -19,13 +19,13 @@
from weboob.tools.capabilities.thumbnail import Thumbnail from weboob.tools.capabilities.thumbnail import Thumbnail
from .base import IBaseCap, CapBaseObject, NotLoaded, Field, StringField, \ from .base import IBaseCap, BaseObject, NotLoaded, Field, StringField, \
BytesField, IntField, FloatField, DateField BytesField, IntField, FloatField, DateField
__all__ = ['BaseGallery', 'BaseImage', 'ICapGallery'] __all__ = ['BaseGallery', 'BaseImage', 'ICapGallery']
class BaseGallery(CapBaseObject): class BaseGallery(BaseObject):
""" """
Represents a gallery. Represents a gallery.
@ -42,7 +42,7 @@ class BaseGallery(CapBaseObject):
def __init__(self, _id, title=NotLoaded, url=NotLoaded, cardinality=NotLoaded, date=NotLoaded, def __init__(self, _id, title=NotLoaded, url=NotLoaded, cardinality=NotLoaded, date=NotLoaded,
rating=NotLoaded, rating_max=NotLoaded, thumbnail=NotLoaded, thumbnail_url=None, nsfw=False): rating=NotLoaded, rating_max=NotLoaded, thumbnail=NotLoaded, thumbnail_url=None, nsfw=False):
CapBaseObject.__init__(self, unicode(_id)) BaseObject.__init__(self, unicode(_id))
self.title = title self.title = title
self.url = url self.url = url
@ -70,7 +70,7 @@ class BaseGallery(CapBaseObject):
raise NotImplementedError() raise NotImplementedError()
class BaseImage(CapBaseObject): class BaseImage(BaseObject):
""" """
Base class for images. Base class for images.
""" """
@ -84,7 +84,7 @@ class BaseImage(CapBaseObject):
def __init__(self, _id, index=None, thumbnail=NotLoaded, url=NotLoaded, def __init__(self, _id, index=None, thumbnail=NotLoaded, url=NotLoaded,
ext=NotLoaded, gallery=None): ext=NotLoaded, gallery=None):
CapBaseObject.__init__(self, unicode(_id)) BaseObject.__init__(self, unicode(_id))
self.index = index self.index = index
self.thumbnail = thumbnail self.thumbnail = thumbnail

Some files were not shown because too many files have changed in this diff Show more