rename CapBaseObject to BaseObject (refs #1424)
This commit is contained in:
parent
4529735935
commit
51958135cb
44 changed files with 183 additions and 183 deletions
|
|
@ -13,7 +13,7 @@ Prefer returning objects
|
|||
|
||||
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),
|
||||
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
|
||||
``get_video_url()``, ``get_video_preview()``, etc.
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import urllib
|
|||
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.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']
|
||||
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ class TrendsPage(TwitterJsonHTMLPage):
|
|||
item_xpath = '//li[@class="trend-item js-trend-item "]'
|
||||
|
||||
class item(ItemElement):
|
||||
klass = CapBaseObject
|
||||
klass = BaseObject
|
||||
|
||||
obj_id = Attr('.', 'data-trend-name')
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
import itertools
|
||||
from nose.plugins.skip import SkipTest
|
||||
from weboob.tools.test import BackendTest
|
||||
from weboob.capabilities.base import CapBaseObject
|
||||
from weboob.capabilities.base import BaseObject
|
||||
|
||||
|
||||
class TwitterTest(BackendTest):
|
||||
|
|
@ -43,7 +43,7 @@ class TwitterTest(BackendTest):
|
|||
|
||||
def test_ls_me(self):
|
||||
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)
|
||||
thread = self.backend.get_thread(l[0].id)
|
||||
assert len(thread.root.content)
|
||||
|
|
@ -51,27 +51,27 @@ class TwitterTest(BackendTest):
|
|||
raise SkipTest("User credentials not defined")
|
||||
|
||||
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)
|
||||
thread = self.backend.get_thread(l[0].id)
|
||||
assert len(thread.root.content)
|
||||
|
||||
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)
|
||||
thread = self.backend.get_thread(l[0].id)
|
||||
assert len(thread.root.content)
|
||||
|
||||
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)
|
||||
thread = self.backend.get_thread(l[0].id)
|
||||
assert len(thread.root.content)
|
||||
|
||||
def test_ls_trend(self):
|
||||
l = list(self.backend.iter_resources([CapBaseObject], ['trendy']))
|
||||
l = list(self.backend.iter_resources([BaseObject], ['trendy']))
|
||||
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)
|
||||
thread = self.backend.get_thread(l1[0].id)
|
||||
assert len(thread.root.content)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import os
|
|||
import re
|
||||
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.tools.application.repl import ReplApplication, defaultcount
|
||||
from weboob.tools.application.formatters.iformatter import IFormatter, PrettyFormatter
|
||||
|
|
@ -47,7 +47,7 @@ class IssueFormatter(IFormatter):
|
|||
return u''
|
||||
|
||||
value = getattr(obj, attr)
|
||||
if isinstance(value, CapBaseObject):
|
||||
if isinstance(value, BaseObject):
|
||||
value = value.name
|
||||
|
||||
return self.format_key(attr.capitalize(), value)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- 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']
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
# 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']
|
||||
|
|
@ -30,7 +30,7 @@ class AccountRegisterError(UserError):
|
|||
"""
|
||||
|
||||
|
||||
class Account(CapBaseObject):
|
||||
class Account(BaseObject):
|
||||
"""
|
||||
Describe an account and its properties.
|
||||
"""
|
||||
|
|
@ -39,7 +39,7 @@ class Account(CapBaseObject):
|
|||
properties = Field('List of key/value properties', dict)
|
||||
|
||||
def __init__(self, id=None):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
|
||||
|
||||
class StatusField(object):
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import re
|
|||
from datetime import timedelta
|
||||
|
||||
from .image import BaseImage
|
||||
from .base import Field, StringField, IntField, CapBaseObject
|
||||
from .base import Field, StringField, IntField, BaseObject
|
||||
from .file import ICapFile, BaseFile
|
||||
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ def decode_id(decode_id):
|
|||
return wrapper
|
||||
|
||||
|
||||
class Album(CapBaseObject):
|
||||
class Album(BaseObject):
|
||||
"""
|
||||
Represent an album
|
||||
"""
|
||||
|
|
@ -55,7 +55,7 @@ class Album(CapBaseObject):
|
|||
tracks_list = Field('list of tracks', list)
|
||||
|
||||
def __init__(self, _id):
|
||||
CapBaseObject.__init__(self, unicode("album.%s" % _id))
|
||||
BaseObject.__init__(self, unicode("album.%s" % _id))
|
||||
|
||||
@classmethod
|
||||
def decode_id(cls, _id):
|
||||
|
|
@ -66,7 +66,7 @@ class Album(CapBaseObject):
|
|||
return _id
|
||||
|
||||
|
||||
class Playlist(CapBaseObject):
|
||||
class Playlist(BaseObject):
|
||||
"""
|
||||
Represent a playlist
|
||||
"""
|
||||
|
|
@ -74,7 +74,7 @@ class Playlist(CapBaseObject):
|
|||
tracks_list = Field('list of tracks', list)
|
||||
|
||||
def __init__(self, _id):
|
||||
CapBaseObject.__init__(self, unicode("playlist.%s" % _id))
|
||||
BaseObject.__init__(self, unicode("playlist.%s" % _id))
|
||||
|
||||
@classmethod
|
||||
def decode_id(cls, _id):
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import re
|
|||
|
||||
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
|
||||
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ class TransferError(UserError):
|
|||
"""
|
||||
|
||||
|
||||
class Recipient(CapBaseObject, Currency):
|
||||
class Recipient(BaseObject, Currency):
|
||||
"""
|
||||
Recipient of a transfer.
|
||||
"""
|
||||
|
|
@ -55,7 +55,7 @@ class Recipient(CapBaseObject, Currency):
|
|||
currency = StringField('Currency', default=None)
|
||||
|
||||
def __init__(self):
|
||||
CapBaseObject.__init__(self, 0)
|
||||
BaseObject.__init__(self, 0)
|
||||
|
||||
@property
|
||||
def currency_text(self):
|
||||
|
|
@ -86,7 +86,7 @@ class Account(Recipient):
|
|||
return u"<Account id=%r label=%r>" % (self.id, self.label)
|
||||
|
||||
|
||||
class Transaction(CapBaseObject):
|
||||
class Transaction(BaseObject):
|
||||
"""
|
||||
Bank transaction.
|
||||
"""
|
||||
|
|
@ -131,7 +131,7 @@ class Transaction(CapBaseObject):
|
|||
return "%08x" % (crc & 0xffffffff)
|
||||
|
||||
|
||||
class Investment(CapBaseObject):
|
||||
class Investment(BaseObject):
|
||||
"""
|
||||
Investment in a financial market.
|
||||
"""
|
||||
|
|
@ -145,7 +145,7 @@ class Investment(CapBaseObject):
|
|||
diff = DecimalField('Difference between the buy cost and the current valuation')
|
||||
|
||||
|
||||
class Transfer(CapBaseObject):
|
||||
class Transfer(BaseObject):
|
||||
"""
|
||||
Transfer from an account to a recipient.
|
||||
"""
|
||||
|
|
@ -169,7 +169,7 @@ class ICapBank(ICapCollection):
|
|||
all accounts (by calling :func:`iter_accounts`).
|
||||
|
||||
:param objs: type of objects to get
|
||||
:type objs: tuple[:class:`CapBaseObject`]
|
||||
:type objs: tuple[:class:`BaseObject`]
|
||||
:param split_path: path to discover
|
||||
:type split_path: :class:`list`
|
||||
:rtype: iter[:class:`BaseCapObject`]
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ from weboob.tools.ordereddict import OrderedDict
|
|||
__all__ = ['UserError', 'FieldNotFound', 'NotAvailable',
|
||||
'NotLoaded', 'IBaseCap', 'Field', 'IntField', 'DecimalField',
|
||||
'FloatField', 'StringField', 'BytesField', 'DateField',
|
||||
'DeltaField', 'empty', 'CapBaseObject']
|
||||
'DeltaField', 'empty', 'BaseObject']
|
||||
|
||||
|
||||
def empty(value):
|
||||
|
|
@ -76,7 +76,7 @@ class FieldNotFound(Exception):
|
|||
A field isn't found.
|
||||
|
||||
:param obj: object
|
||||
:type obj: :class:`CapBaseObject`
|
||||
:type obj: :class:`BaseObject`
|
||||
:param field: field not found
|
||||
:type field: :class:`Field`
|
||||
"""
|
||||
|
|
@ -126,7 +126,7 @@ class NotLoadedType(object):
|
|||
"""
|
||||
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.
|
||||
"""
|
||||
|
||||
|
|
@ -155,13 +155,13 @@ class IBaseCap(object):
|
|||
A capability may define abstract methods (which raise :class:`NotImplementedError`)
|
||||
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):
|
||||
"""
|
||||
Field of a :class:`CapBaseObject` class.
|
||||
Field of a :class:`BaseObject` class.
|
||||
|
||||
:param doc: docstring of the field
|
||||
:type doc: :class:`str`
|
||||
|
|
@ -284,12 +284,12 @@ class DeltaField(Field):
|
|||
Field.__init__(self, doc, datetime.timedelta, **kwargs)
|
||||
|
||||
|
||||
class _CapBaseObjectMeta(type):
|
||||
class _BaseObjectMeta(type):
|
||||
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.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:
|
||||
new_class._fields = OrderedDict()
|
||||
else:
|
||||
|
|
@ -306,7 +306,7 @@ class _CapBaseObjectMeta(type):
|
|||
return new_class
|
||||
|
||||
|
||||
class CapBaseObject(object):
|
||||
class BaseObject(object):
|
||||
"""
|
||||
This is the base class for a capability object.
|
||||
|
||||
|
|
@ -319,7 +319,7 @@ class CapBaseObject(object):
|
|||
|
||||
For example::
|
||||
|
||||
class Transfer(CapBaseObject):
|
||||
class Transfer(BaseObject):
|
||||
" Transfer from an account to a recipient. "
|
||||
|
||||
amount = DecimalField('Amount to transfer')
|
||||
|
|
@ -330,7 +330,7 @@ class CapBaseObject(object):
|
|||
The docstring is mandatory.
|
||||
"""
|
||||
|
||||
__metaclass__ = _CapBaseObjectMeta
|
||||
__metaclass__ = _BaseObjectMeta
|
||||
|
||||
id = None
|
||||
backend = None
|
||||
|
|
@ -394,7 +394,7 @@ class CapBaseObject(object):
|
|||
yield name, field.value
|
||||
|
||||
def __eq__(self, obj):
|
||||
if isinstance(obj, CapBaseObject):
|
||||
if isinstance(obj, BaseObject):
|
||||
return self.backend == obj.backend and self.id == obj.id
|
||||
else:
|
||||
return False
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
# 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
|
||||
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ class BillNotFound(UserError):
|
|||
UserError.__init__(self, msg)
|
||||
|
||||
|
||||
class Detail(CapBaseObject):
|
||||
class Detail(BaseObject):
|
||||
"""
|
||||
Detail of a subscription
|
||||
"""
|
||||
|
|
@ -55,10 +55,10 @@ class Detail(CapBaseObject):
|
|||
unit = StringField('Unit of the consumption')
|
||||
|
||||
def __init__(self):
|
||||
CapBaseObject.__init__(self, 0)
|
||||
BaseObject.__init__(self, 0)
|
||||
|
||||
|
||||
class Bill(CapBaseObject):
|
||||
class Bill(BaseObject):
|
||||
"""
|
||||
Bill.
|
||||
"""
|
||||
|
|
@ -73,10 +73,10 @@ class Bill(CapBaseObject):
|
|||
finishdate = DateField('The last day the bill applies to')
|
||||
|
||||
def __init__(self):
|
||||
CapBaseObject.__init__(self, 0)
|
||||
BaseObject.__init__(self, 0)
|
||||
|
||||
|
||||
class Subscription(CapBaseObject):
|
||||
class Subscription(BaseObject):
|
||||
"""
|
||||
Subscription to a service.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
# 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
|
||||
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ class IssueError(UserError):
|
|||
"""
|
||||
|
||||
|
||||
class Project(CapBaseObject):
|
||||
class Project(BaseObject):
|
||||
"""
|
||||
Represents a project.
|
||||
"""
|
||||
|
|
@ -45,7 +45,7 @@ class Project(CapBaseObject):
|
|||
priorities = Field('Available priorities for issues', list)
|
||||
|
||||
def __init__(self, id, name):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.name = unicode(name)
|
||||
|
||||
def __repr__(self):
|
||||
|
|
@ -105,35 +105,35 @@ class Project(CapBaseObject):
|
|||
return None
|
||||
|
||||
|
||||
class User(CapBaseObject):
|
||||
class User(BaseObject):
|
||||
"""
|
||||
User.
|
||||
"""
|
||||
name = StringField('Name of user')
|
||||
|
||||
def __init__(self, id, name):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.name = unicode(name)
|
||||
|
||||
def __repr__(self):
|
||||
return '<User %r>' % self.name
|
||||
|
||||
|
||||
class Version(CapBaseObject):
|
||||
class Version(BaseObject):
|
||||
"""
|
||||
Version of a project.
|
||||
"""
|
||||
name = StringField('Name of version')
|
||||
|
||||
def __init__(self, id, name):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.name = unicode(name)
|
||||
|
||||
def __repr__(self):
|
||||
return '<Version %r>' % self.name
|
||||
|
||||
|
||||
class Status(CapBaseObject):
|
||||
class Status(BaseObject):
|
||||
"""
|
||||
Status of an issue.
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ class Status(CapBaseObject):
|
|||
value = IntField('Value of status (constants VALUE_*)')
|
||||
|
||||
def __init__(self, id, name, value):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.name = unicode(name)
|
||||
self.value = value
|
||||
|
||||
|
|
@ -157,7 +157,7 @@ class Status(CapBaseObject):
|
|||
return '<Status %r>' % self.name
|
||||
|
||||
|
||||
class Attachment(CapBaseObject):
|
||||
class Attachment(BaseObject):
|
||||
"""
|
||||
Attachment of an issue.
|
||||
"""
|
||||
|
|
@ -168,7 +168,7 @@ class Attachment(CapBaseObject):
|
|||
return '<Attachment %r>' % self.filename
|
||||
|
||||
|
||||
class Change(CapBaseObject):
|
||||
class Change(BaseObject):
|
||||
"""
|
||||
A change of an update.
|
||||
"""
|
||||
|
|
@ -177,7 +177,7 @@ class Change(CapBaseObject):
|
|||
new = StringField('New value of field')
|
||||
|
||||
|
||||
class Update(CapBaseObject):
|
||||
class Update(BaseObject):
|
||||
"""
|
||||
Represents an update of an issue.
|
||||
"""
|
||||
|
|
@ -192,7 +192,7 @@ class Update(CapBaseObject):
|
|||
return '<Update %r>' % self.id
|
||||
|
||||
|
||||
class Issue(CapBaseObject):
|
||||
class Issue(BaseObject):
|
||||
"""
|
||||
Represents an issue.
|
||||
"""
|
||||
|
|
@ -215,7 +215,7 @@ class Issue(CapBaseObject):
|
|||
priority = StringField('Priority of the issue') #XXX
|
||||
|
||||
|
||||
class Query(CapBaseObject):
|
||||
class Query(BaseObject):
|
||||
"""
|
||||
Query to find an issue.
|
||||
"""
|
||||
|
|
@ -228,7 +228,7 @@ class Query(CapBaseObject):
|
|||
status = StringField('Filter on statuses')
|
||||
|
||||
def __init__(self):
|
||||
CapBaseObject.__init__(self, '')
|
||||
BaseObject.__init__(self, '')
|
||||
|
||||
|
||||
class ICapBugTracker(IBaseCap):
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# 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 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')
|
||||
|
||||
|
||||
class BaseCalendarEvent(CapBaseObject):
|
||||
class BaseCalendarEvent(BaseObject):
|
||||
"""
|
||||
Represents a calendar event
|
||||
"""
|
||||
|
|
@ -85,7 +85,7 @@ class BaseCalendarEvent(CapBaseObject):
|
|||
return self.id2url(self.id)
|
||||
|
||||
|
||||
class Query(CapBaseObject):
|
||||
class Query(BaseObject):
|
||||
"""
|
||||
Query to find events
|
||||
"""
|
||||
|
|
@ -96,7 +96,7 @@ class Query(CapBaseObject):
|
|||
categories = Field('List of categories of the event', list, tuple)
|
||||
|
||||
def __init__(self):
|
||||
CapBaseObject.__init__(self, '')
|
||||
BaseObject.__init__(self, '')
|
||||
self.categories = []
|
||||
for value in CATEGORIES.values:
|
||||
self.categories.append(value)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
import datetime
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, StringField, DateField, UserError
|
||||
from .base import IBaseCap, BaseObject, StringField, DateField, UserError
|
||||
|
||||
|
||||
__all__ = ['ChatException', 'ChatMessage', 'ICapChat']
|
||||
|
|
@ -32,7 +32,7 @@ class ChatException(UserError):
|
|||
"""
|
||||
|
||||
|
||||
class ChatMessage(CapBaseObject):
|
||||
class ChatMessage(BaseObject):
|
||||
"""
|
||||
Message on the chat.
|
||||
"""
|
||||
|
|
@ -42,7 +42,7 @@ class ChatMessage(CapBaseObject):
|
|||
date = DateField('Date when the message has been sent')
|
||||
|
||||
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_to = id_to
|
||||
self.message = message
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@
|
|||
# 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']
|
||||
|
||||
|
||||
class Movie(CapBaseObject):
|
||||
class Movie(BaseObject):
|
||||
"""
|
||||
Movie object.
|
||||
"""
|
||||
|
|
@ -42,11 +42,11 @@ class Movie(CapBaseObject):
|
|||
thumbnail_url = StringField('Url of movie thumbnail')
|
||||
|
||||
def __init__(self, id, original_title):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.original_title = original_title
|
||||
|
||||
|
||||
class Person(CapBaseObject):
|
||||
class Person(BaseObject):
|
||||
"""
|
||||
Person object.
|
||||
"""
|
||||
|
|
@ -64,7 +64,7 @@ class Person(CapBaseObject):
|
|||
thumbnail_url = StringField('Url of person thumbnail')
|
||||
|
||||
def __init__(self, id, name):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.name = name
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
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']
|
||||
|
|
@ -34,13 +34,13 @@ class CollectionNotFound(UserError):
|
|||
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.
|
||||
However, this probably will not work properly for now.
|
||||
"""
|
||||
def __init__(self, split_path):
|
||||
CapBaseObject.__init__(self, None)
|
||||
BaseObject.__init__(self, None)
|
||||
self.split_path = split_path
|
||||
|
||||
@property
|
||||
|
|
@ -76,7 +76,7 @@ class Collection(BaseCollection):
|
|||
|
||||
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.
|
||||
"""
|
||||
title = StringField('Collection title')
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
# 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
|
||||
from weboob.tools.ordereddict import OrderedDict
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ class ProfileNode(object):
|
|||
return self.value[key]
|
||||
|
||||
|
||||
class ContactPhoto(CapBaseObject):
|
||||
class ContactPhoto(BaseObject):
|
||||
"""
|
||||
Photo of a contact.
|
||||
"""
|
||||
|
|
@ -56,7 +56,7 @@ class ContactPhoto(CapBaseObject):
|
|||
hidden = Field('True if the photo is hidden on website', bool)
|
||||
|
||||
def __init__(self, name):
|
||||
CapBaseObject.__init__(self, name)
|
||||
BaseObject.__init__(self, name)
|
||||
self.name = name
|
||||
|
||||
def __iscomplete__(self):
|
||||
|
|
@ -71,7 +71,7 @@ class ContactPhoto(CapBaseObject):
|
|||
len(self.thumbnail_data) if self.thumbnail_data else 0)
|
||||
|
||||
|
||||
class Contact(CapBaseObject):
|
||||
class Contact(BaseObject):
|
||||
"""
|
||||
A contact.
|
||||
"""
|
||||
|
|
@ -89,7 +89,7 @@ class Contact(CapBaseObject):
|
|||
profile = Field('Contact profile', dict)
|
||||
|
||||
def __init__(self, id, name, status):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.name = name
|
||||
self.status = status
|
||||
|
||||
|
|
@ -154,14 +154,14 @@ class QueryError(UserError):
|
|||
"""
|
||||
|
||||
|
||||
class Query(CapBaseObject):
|
||||
class Query(BaseObject):
|
||||
"""
|
||||
Query to send to a contact.
|
||||
"""
|
||||
message = StringField('Message received')
|
||||
|
||||
def __init__(self, id, message):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.message = message
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@
|
|||
# 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']
|
||||
|
||||
|
||||
class Content(CapBaseObject):
|
||||
class Content(BaseObject):
|
||||
"""
|
||||
Content object.
|
||||
"""
|
||||
|
|
@ -34,7 +34,7 @@ class Content(CapBaseObject):
|
|||
revision = StringField('ID of revision')
|
||||
|
||||
|
||||
class Revision(CapBaseObject):
|
||||
class Revision(BaseObject):
|
||||
"""
|
||||
Revision of a change on a content.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
# 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
|
||||
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ class Optimization(object):
|
|||
raise NotImplementedError()
|
||||
|
||||
|
||||
class Event(CapBaseObject):
|
||||
class Event(BaseObject):
|
||||
"""
|
||||
A dating event (for example a visite, a query received, etc.)
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@
|
|||
# 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']
|
||||
|
||||
|
||||
class BaseFile(CapBaseObject):
|
||||
class BaseFile(BaseObject):
|
||||
"""
|
||||
Represent a file.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@
|
|||
|
||||
|
||||
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
|
||||
|
||||
__all__ = ['BaseGallery', 'BaseImage', 'ICapGallery']
|
||||
|
||||
|
||||
class BaseGallery(CapBaseObject):
|
||||
class BaseGallery(BaseObject):
|
||||
"""
|
||||
Represents a gallery.
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ class BaseGallery(CapBaseObject):
|
|||
|
||||
def __init__(self, _id, title=NotLoaded, url=NotLoaded, cardinality=NotLoaded, date=NotLoaded,
|
||||
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.url = url
|
||||
|
|
@ -70,7 +70,7 @@ class BaseGallery(CapBaseObject):
|
|||
raise NotImplementedError()
|
||||
|
||||
|
||||
class BaseImage(CapBaseObject):
|
||||
class BaseImage(BaseObject):
|
||||
"""
|
||||
Base class for images.
|
||||
"""
|
||||
|
|
@ -84,7 +84,7 @@ class BaseImage(CapBaseObject):
|
|||
def __init__(self, _id, index=None, thumbnail=NotLoaded, url=NotLoaded,
|
||||
ext=NotLoaded, gallery=None):
|
||||
|
||||
CapBaseObject.__init__(self, unicode(_id))
|
||||
BaseObject.__init__(self, unicode(_id))
|
||||
|
||||
self.index = index
|
||||
self.thumbnail = thumbnail
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue