use "basestring" instead of "(str,unicode)"
This commit is contained in:
parent
1c9817a090
commit
916400467e
10 changed files with 41 additions and 41 deletions
|
|
@ -244,7 +244,7 @@ class ContactProfile(QWidget):
|
|||
elif isinstance(node.value, tuple):
|
||||
value = QLabel(', '.join([unicode(s) for s in node.value]))
|
||||
value.setWordWrap(True)
|
||||
elif isinstance(node.value, (str,unicode,int,long,float)):
|
||||
elif isinstance(node.value, (basestring,int,long,float)):
|
||||
value = QLabel(unicode(node.value))
|
||||
else:
|
||||
logging.warning('Not supported value: %r' % node.value)
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
|||
with self.browser:
|
||||
if isinstance(contact, Contact):
|
||||
_id = contact.id
|
||||
elif isinstance(contact, (int,long,str,unicode)):
|
||||
elif isinstance(contact, (int,long,basestring)):
|
||||
_id = contact
|
||||
else:
|
||||
raise TypeError("The parameter 'contact' isn't a contact nor a int/long/str/unicode: %s" % contact)
|
||||
|
|
|
|||
|
|
@ -34,10 +34,10 @@ class NotEnoughMoney(Exception):
|
|||
class Account(CapBaseObject):
|
||||
def __init__(self):
|
||||
CapBaseObject.__init__(self, 0)
|
||||
self.add_field('label', (str,unicode))
|
||||
self.add_field('label', basestring)
|
||||
self.add_field('balance', float)
|
||||
self.add_field('coming', float)
|
||||
self.add_field('link_id', (str,unicode))
|
||||
self.add_field('link_id', basestring)
|
||||
|
||||
def __repr__(self):
|
||||
return u"<Account id='%s' label='%s'>" % (self.id, self.label)
|
||||
|
|
@ -46,7 +46,7 @@ class Account(CapBaseObject):
|
|||
class Operation(CapBaseObject):
|
||||
def __init__(self, id):
|
||||
CapBaseObject.__init__(self, id)
|
||||
self.add_field('date', (str,unicode,datetime))
|
||||
self.add_field('date', (basestring,datetime))
|
||||
self.add_field('label', unicode)
|
||||
self.add_field('amount', float)
|
||||
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ class ChatException(Exception):
|
|||
class ChatMessage(CapBaseObject):
|
||||
def __init__(self, id_from, id_to, message, date=None):
|
||||
CapBaseObject.__init__(self, '%s.%s' % (id_from, id_to))
|
||||
self.add_field('id_from', (str,unicode), id_from)
|
||||
self.add_field('id_to', (str,unicode), id_to)
|
||||
self.add_field('message', (str,unicode), message)
|
||||
self.add_field('id_from', basestring, id_from)
|
||||
self.add_field('id_to', basestring, id_to)
|
||||
self.add_field('message', basestring, message)
|
||||
self.add_field('date', datetime.datetime, date)
|
||||
|
||||
if self.date is None:
|
||||
|
|
|
|||
|
|
@ -36,11 +36,11 @@ class ProfileNode(object):
|
|||
class ContactPhoto(CapBaseObject):
|
||||
def __init__(self, name):
|
||||
CapBaseObject.__init__(self, name)
|
||||
self.add_field('name', (str,unicode), name)
|
||||
self.add_field('url', (str,unicode))
|
||||
self.add_field('name', basestring, name)
|
||||
self.add_field('url', basestring)
|
||||
self.add_field('data', str)
|
||||
self.add_field('thumbnail_url', (str,unicode))
|
||||
self.add_field('thumbnail_data', (str,unicode))
|
||||
self.add_field('thumbnail_url', basestring)
|
||||
self.add_field('thumbnail_data', basestring)
|
||||
|
||||
def __iscomplete__(self):
|
||||
return (self.data and (not self.thumbnail_url or self.thumbnail_data))
|
||||
|
|
@ -61,10 +61,10 @@ class Contact(CapBaseObject):
|
|||
|
||||
def __init__(self, id, name, status):
|
||||
CapBaseObject.__init__(self, id)
|
||||
self.add_field('name', (str,unicode), name)
|
||||
self.add_field('name', basestring, name)
|
||||
self.add_field('status', int, status)
|
||||
self.add_field('status_msg', (str,unicode))
|
||||
self.add_field('summary', (str,unicode))
|
||||
self.add_field('status_msg', basestring)
|
||||
self.add_field('summary', basestring)
|
||||
self.add_field('photos', dict, OrderedDict())
|
||||
self.add_field('profile', list)
|
||||
|
||||
|
|
|
|||
|
|
@ -27,15 +27,15 @@ class IpLocation(CapBaseObject):
|
|||
CapBaseObject.__init__(self, ipaddr)
|
||||
|
||||
self.ipaddr = ipaddr
|
||||
self.add_field('city', (str,unicode))
|
||||
self.add_field('region', (str,unicode))
|
||||
self.add_field('zipcode', (str,unicode))
|
||||
self.add_field('country', (str,unicode))
|
||||
self.add_field('city', basestring)
|
||||
self.add_field('region', basestring)
|
||||
self.add_field('zipcode', basestring)
|
||||
self.add_field('country', basestring)
|
||||
self.add_field('lt', float)
|
||||
self.add_field('lg', float)
|
||||
self.add_field('host', (str,unicode))
|
||||
self.add_field('tld', (str,unicode))
|
||||
self.add_field('isp', (str,unicode))
|
||||
self.add_field('host', basestring)
|
||||
self.add_field('tld', basestring)
|
||||
self.add_field('isp', basestring)
|
||||
|
||||
class ICapGeolocIp(IBaseCap):
|
||||
def get_location(self, ipaddr):
|
||||
|
|
|
|||
|
|
@ -43,13 +43,13 @@ class Message(CapBaseObject):
|
|||
flags=0):
|
||||
CapBaseObject.__init__(self, id)
|
||||
self.add_field('thread', Thread, thread)
|
||||
self.add_field('title', (str,unicode), title)
|
||||
self.add_field('sender', (str,unicode), sender)
|
||||
self.add_field('receiver', (str,unicode), receiver)
|
||||
self.add_field('title', basestring, title)
|
||||
self.add_field('sender', basestring, sender)
|
||||
self.add_field('receiver', basestring, receiver)
|
||||
self.add_field('date', datetime.datetime, date)
|
||||
self.add_field('parent', Message, parent)
|
||||
self.add_field('content', (str,unicode), content)
|
||||
self.add_field('signature', (str,unicode), signature)
|
||||
self.add_field('content', basestring, content)
|
||||
self.add_field('signature', basestring, signature)
|
||||
self.add_field('children', list, children)
|
||||
self.add_field('flags', int, flags)
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ class Thread(CapBaseObject):
|
|||
def __init__(self, id):
|
||||
CapBaseObject.__init__(self, id)
|
||||
self.add_field('root', Message)
|
||||
self.add_field('title', (str,unicode))
|
||||
self.add_field('title', basestring)
|
||||
self.add_field('date', datetime.datetime)
|
||||
self.add_field('nb_messages', int)
|
||||
self.add_field('nb_unread', int)
|
||||
|
|
|
|||
|
|
@ -28,14 +28,14 @@ class Torrent(CapBaseObject):
|
|||
seeders=NotLoaded, leechers=NotLoaded, files=NotLoaded,
|
||||
description=NotLoaded):
|
||||
CapBaseObject.__init__(self, id)
|
||||
self.add_field('name', (str,unicode), name)
|
||||
self.add_field('name', basestring, name)
|
||||
self.add_field('size', (int,long,float), size)
|
||||
self.add_field('date', datetime, date)
|
||||
self.add_field('url', (str,unicode), url)
|
||||
self.add_field('url', basestring, url)
|
||||
self.add_field('seeders', int, seeders)
|
||||
self.add_field('leechers', int, leechers)
|
||||
self.add_field('files', list, files)
|
||||
self.add_field('description', (str,unicode), description)
|
||||
self.add_field('description', basestring, description)
|
||||
|
||||
class ICapTorrent(IBaseCap):
|
||||
def iter_torrents(self, pattern):
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ __all__ = ['Departure', 'ICapTravel', 'Station']
|
|||
class Station(CapBaseObject):
|
||||
def __init__(self, id, name):
|
||||
CapBaseObject.__init__(self, id)
|
||||
self.add_field('name', (str,unicode), name)
|
||||
self.add_field('name', basestring, name)
|
||||
|
||||
def __repr__(self):
|
||||
return "<Station id=%r name=%r>" % (self.id, self.name)
|
||||
|
|
@ -37,13 +37,13 @@ class Departure(CapBaseObject):
|
|||
def __init__(self, id, _type, _time):
|
||||
CapBaseObject.__init__(self, id)
|
||||
|
||||
self.add_field('type', (str,unicode), _type)
|
||||
self.add_field('type', basestring, _type)
|
||||
self.add_field('time', datetime, _time)
|
||||
self.add_field('departure_station', (str,unicode))
|
||||
self.add_field('arrival_station', (str,unicode))
|
||||
self.add_field('departure_station', basestring)
|
||||
self.add_field('arrival_station', basestring)
|
||||
self.add_field('late', time, time())
|
||||
self.add_field('information', (str,unicode))
|
||||
self.add_field('plateform', (str,unicode))
|
||||
self.add_field('information', basestring)
|
||||
self.add_field('plateform', basestring)
|
||||
|
||||
def __repr__(self):
|
||||
return u"<Departure id=%r type=%r time=%r departure=%r arrival=%r>" % (
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ __all__ = ['BaseVideo', 'ICapVideo']
|
|||
class VideoThumbnail(CapBaseObject):
|
||||
def __init__(self, url):
|
||||
CapBaseObject.__init__(self, url)
|
||||
self.add_field('url', (unicode,str), url.replace(' ', '%20'))
|
||||
self.add_field('url', basestring, url.replace(' ', '%20'))
|
||||
self.add_field('data', str)
|
||||
|
||||
def __str__(self):
|
||||
|
|
@ -45,9 +45,9 @@ class BaseVideo(CapBaseObject):
|
|||
rating=NotLoaded, rating_max=NotLoaded, thumbnail=NotLoaded, thumbnail_url=None, nsfw=False):
|
||||
CapBaseObject.__init__(self, unicode(_id))
|
||||
|
||||
self.add_field('title', (str,unicode), title)
|
||||
self.add_field('url', (str,unicode), url)
|
||||
self.add_field('author', (str,unicode), author)
|
||||
self.add_field('title', basestring, title)
|
||||
self.add_field('url', basestring, url)
|
||||
self.add_field('author', basestring, author)
|
||||
self.add_field('duration', (int,long,timedelta), duration)
|
||||
self.add_field('date', datetime, date)
|
||||
self.add_field('rating', (int,long,float), rating)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue