add url to contacts

This commit is contained in:
Christophe Benz 2010-11-17 18:42:39 +01:00
commit 3c78b37f95
3 changed files with 7 additions and 3 deletions

View file

@ -330,7 +330,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
contact.name = profile.get_name() contact.name = profile.get_name()
contact.status = s contact.status = s
else: else:
contact = Contact(_id, profile.get_name(), s) contact = Contact(_id, profile.get_name(), s, self.browser.id2url(_id))
contact.status_msg = profile.get_status() contact.status_msg = profile.get_status()
contact.summary = profile.description contact.summary = profile.description
for photo in profile.photos: for photo in profile.photos:
@ -367,7 +367,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
continue continue
# TODO age in contact['birthday'] # TODO age in contact['birthday']
c = Contact(contact['id'], contact['pseudo'], s) c = Contact(contact['id'], contact['pseudo'], s, self.browser.id2url(contact['id']))
c.status_msg = u'%s old' % contact['birthday'] c.status_msg = u'%s old' % contact['birthday']
c.set_photo(contact['cover'].split('/')[-1].replace('thumb0_', 'image'), thumbnail_url=contact['cover']) c.set_photo(contact['cover'].split('/')[-1].replace('thumb0_', 'image'), thumbnail_url=contact['cover'])
yield c yield c

View file

@ -89,6 +89,9 @@ class AuMBrowser(BaseBrowser):
BaseBrowser.__init__(self, *args, **kwargs) BaseBrowser.__init__(self, *args, **kwargs)
self.my_id = 0 self.my_id = 0
def id2url(self, _id):
return u'%s://%s/%s' % (self.PROTOCOL, self.DOMAIN, _id)
def login(self): def login(self):
if not self.is_on_page(LoginPage): if not self.is_on_page(LoginPage):
self.home() self.home()

View file

@ -59,10 +59,11 @@ class Contact(CapBaseObject):
STATUS_OFFLINE = 0x004 STATUS_OFFLINE = 0x004
STATUS_ALL = 0xfff STATUS_ALL = 0xfff
def __init__(self, id, name, status): def __init__(self, id, name, status, url):
CapBaseObject.__init__(self, id) CapBaseObject.__init__(self, id)
self.add_field('name', basestring, name) self.add_field('name', basestring, name)
self.add_field('status', int, status) self.add_field('status', int, status)
self.add_field('url', basestring, url)
self.add_field('status_msg', basestring) self.add_field('status_msg', basestring)
self.add_field('summary', basestring) self.add_field('summary', basestring)
self.add_field('photos', dict, OrderedDict()) self.add_field('photos', dict, OrderedDict())