correctly fill the profile in Contact object
This commit is contained in:
parent
47a5c8028e
commit
45f0b72657
2 changed files with 14 additions and 16 deletions
|
|
@ -27,7 +27,7 @@ from weboob.core.backend import BaseBackend
|
||||||
from weboob.capabilities.chat import ICapChat
|
from weboob.capabilities.chat import ICapChat
|
||||||
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply, Message
|
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply, Message
|
||||||
from weboob.capabilities.dating import ICapDating, StatusField
|
from weboob.capabilities.dating import ICapDating, StatusField
|
||||||
from weboob.capabilities.contact import ICapContact, Contact
|
from weboob.capabilities.contact import ICapContact, Contact, ProfileNode
|
||||||
from weboob.tools.browser import BrowserUnavailable
|
from weboob.tools.browser import BrowserUnavailable
|
||||||
|
|
||||||
from .browser import AdopteUnMec
|
from .browser import AdopteUnMec
|
||||||
|
|
@ -177,20 +177,17 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesReply, ICapDating, ICapC
|
||||||
contact.summary = profile.description
|
contact.summary = profile.description
|
||||||
contact.avatar = None
|
contact.avatar = None
|
||||||
contact.photos = profile.photos
|
contact.photos = profile.photos
|
||||||
#body += u'\nStats:'
|
contact.profile = []
|
||||||
#for label, value in self.get_stats().iteritems():
|
|
||||||
# body += u'\n\t\t%-15s %s' % (label + ':', value)
|
stats = ProfileNode('stats', 'Stats', [], flags=ProfileNode.HEAD|ProfileNode.SECTION)
|
||||||
#body += u'\n\nInformations:'
|
for label, value in self.get_stats().iteritems():
|
||||||
#for section, d in self.get_table().iteritems():
|
stats.value.append(ProfileNode(label, label.capitalize(), value))
|
||||||
# body += u'\n\t%s\n' % section
|
contact.profile.append(stats)
|
||||||
# for key, value in d.items():
|
|
||||||
# key = '%s:' % key
|
for section, d in self.get_table().iteritems():
|
||||||
# if isinstance(value, list):
|
s = ProfileNode(section, section.capitalize(), [], flags=ProfileNode.SECTION)
|
||||||
# body += u'\t\t%-15s %s\n' % (key, u', '.join([unicode(s) for s in value]))
|
for key, value in d.iteritems():
|
||||||
# elif isinstance(value, float):
|
s.value.append(ProfileNode(key, key.capitalize(), value))
|
||||||
# body += u'\t\t%-15s %.2f\n' % (key, value)
|
|
||||||
# else:
|
|
||||||
# body += u'\t\t%-15s %s\n' % (key, unicode(value))
|
|
||||||
except BrowserUnavailable:
|
except BrowserUnavailable:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@ from .cap import ICap
|
||||||
__all__ = ['ICapContact', 'Contact']
|
__all__ = ['ICapContact', 'Contact']
|
||||||
|
|
||||||
class ProfileNode(object):
|
class ProfileNode(object):
|
||||||
HEAD = 0x01
|
HEAD = 0x01
|
||||||
|
SECTION = 0x02
|
||||||
|
|
||||||
def __init__(self, name, label, value, sufix=None, flags=None):
|
def __init__(self, name, label, value, sufix=None, flags=None):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue