rename CapBaseObject to BaseObject (refs #1424)
This commit is contained in:
parent
4529735935
commit
51958135cb
44 changed files with 183 additions and 183 deletions
|
|
@ -28,7 +28,7 @@ import sys
|
|||
import tempfile
|
||||
import warnings
|
||||
|
||||
from weboob.capabilities.base import ConversionWarning, CapBaseObject
|
||||
from weboob.capabilities.base import ConversionWarning, BaseObject
|
||||
from weboob.core import Weboob, CallErrors
|
||||
from weboob.core.backendscfg import BackendsConfig
|
||||
from weboob.tools.config.iconfig import ConfigError
|
||||
|
|
@ -251,7 +251,7 @@ class BaseApplication(object):
|
|||
def _do_complete_obj(self, backend, fields, obj):
|
||||
if not obj:
|
||||
return obj
|
||||
if not isinstance(obj, CapBaseObject):
|
||||
if not isinstance(obj, BaseObject):
|
||||
return obj
|
||||
|
||||
obj.backend = backend.name
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ else:
|
|||
finally:
|
||||
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
|
||||
|
||||
from weboob.capabilities.base import CapBaseObject
|
||||
from weboob.capabilities.base import BaseObject
|
||||
from weboob.tools.application.console import ConsoleApplication
|
||||
from weboob.tools.ordereddict import OrderedDict
|
||||
|
||||
|
|
@ -139,13 +139,13 @@ class IFormatter(object):
|
|||
An object has fields which can be selected.
|
||||
|
||||
:param obj: object to format
|
||||
:type obj: CapBaseObject or dict
|
||||
:type obj: BaseObject or dict
|
||||
:param selected_fields: fields to display. If None, all fields are selected
|
||||
:type selected_fields: tuple
|
||||
:param alias: an alias to use instead of the object's ID
|
||||
:type alias: unicode
|
||||
"""
|
||||
if isinstance(obj, CapBaseObject):
|
||||
if isinstance(obj, BaseObject):
|
||||
if selected_fields: # can be an empty list (nothing to do), or None (return all fields)
|
||||
obj = obj.copy()
|
||||
for name, value in obj.iter_fields():
|
||||
|
|
@ -162,7 +162,7 @@ class IFormatter(object):
|
|||
try:
|
||||
obj = OrderedDict(obj)
|
||||
except ValueError:
|
||||
raise TypeError('Please give a CapBaseObject or a dict')
|
||||
raise TypeError('Please give a BaseObject or a dict')
|
||||
|
||||
if selected_fields:
|
||||
obj = obj.copy()
|
||||
|
|
@ -188,7 +188,7 @@ class IFormatter(object):
|
|||
This method has to be overridden in child classes.
|
||||
|
||||
:param obj: object to format
|
||||
:type obj: CapBaseObject
|
||||
:type obj: BaseObject
|
||||
:rtype: str
|
||||
"""
|
||||
return self.format_dict(obj.to_dict())
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ from optparse import OptionGroup, OptionParser, IndentedHelpFormatter
|
|||
import os
|
||||
import sys
|
||||
|
||||
from weboob.capabilities.base import FieldNotFound, CapBaseObject, UserError
|
||||
from weboob.capabilities.base import FieldNotFound, BaseObject, UserError
|
||||
from weboob.core import CallErrors
|
||||
from weboob.tools.application.formatters.iformatter import MandatoryFieldsNotFound
|
||||
from weboob.tools.misc import to_unicode
|
||||
|
|
@ -192,7 +192,7 @@ class ReplApplication(Cmd, ConsoleApplication):
|
|||
except (IndexError, ValueError):
|
||||
pass
|
||||
else:
|
||||
if isinstance(obj, CapBaseObject):
|
||||
if isinstance(obj, BaseObject):
|
||||
id = obj.fullid
|
||||
try:
|
||||
return ConsoleApplication.parse_id(self, id, unique_backend)
|
||||
|
|
@ -1147,7 +1147,7 @@ class ReplApplication(Cmd, ConsoleApplication):
|
|||
the object.
|
||||
|
||||
:param obj: object
|
||||
:type obj: CapBaseObject
|
||||
:type obj: BaseObject
|
||||
:param dest: dest given by user (default None)
|
||||
:type dest: str
|
||||
:param default: default file mask (if not given, this is '{id}-{title}.{ext}')
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import os
|
|||
from threading import RLock
|
||||
from copy import copy
|
||||
|
||||
from weboob.capabilities.base import CapBaseObject, FieldNotFound, \
|
||||
from weboob.capabilities.base import BaseObject, FieldNotFound, \
|
||||
IBaseCap, NotLoaded, NotAvailable
|
||||
from weboob.tools.misc import iter_fields
|
||||
from weboob.tools.log import getLogger
|
||||
|
|
@ -381,7 +381,7 @@ class BaseBackend(object):
|
|||
return obj
|
||||
|
||||
def not_loaded(v):
|
||||
return (v is NotLoaded or isinstance(v, CapBaseObject) and not v.__iscomplete__())
|
||||
return (v is NotLoaded or isinstance(v, BaseObject) and not v.__iscomplete__())
|
||||
|
||||
if isinstance(fields, basestring):
|
||||
fields = (fields,)
|
||||
|
|
@ -389,7 +389,7 @@ class BaseBackend(object):
|
|||
missing_fields = []
|
||||
if fields is None:
|
||||
# Select all fields
|
||||
if isinstance(obj, CapBaseObject):
|
||||
if isinstance(obj, BaseObject):
|
||||
fields = [item[0] for item in obj.iter_fields()]
|
||||
else:
|
||||
fields = [item[0] for item in iter_fields(obj)]
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from weboob.capabilities.base import CapBaseObject, StringField
|
||||
from weboob.capabilities.base import BaseObject, StringField
|
||||
|
||||
__all__ = ['StreamInfo']
|
||||
|
||||
|
||||
class StreamInfo(CapBaseObject):
|
||||
class StreamInfo(BaseObject):
|
||||
"""
|
||||
Stream related information.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@
|
|||
# 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 weboob.capabilities.base import CapBaseObject, NotLoaded, StringField, BytesField
|
||||
from weboob.capabilities.base import BaseObject, NotLoaded, StringField, BytesField
|
||||
|
||||
|
||||
__all__ = ['Thumbnail']
|
||||
|
||||
|
||||
class Thumbnail(CapBaseObject):
|
||||
class Thumbnail(BaseObject):
|
||||
"""
|
||||
Thumbnail of an image.
|
||||
"""
|
||||
|
|
@ -32,7 +32,7 @@ class Thumbnail(CapBaseObject):
|
|||
data = BytesField('Data')
|
||||
|
||||
def __init__(self, url):
|
||||
CapBaseObject.__init__(self, url)
|
||||
BaseObject.__init__(self, url)
|
||||
self.url = url.replace(u' ', u'%20')
|
||||
|
||||
def __str__(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue