From 98352c71eeaf334c9933bd11f03074e1389ad66f Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Sun, 11 Apr 2010 18:06:05 +0200 Subject: [PATCH] ICapDating capability --- weboob/capabilities/dating.py | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 weboob/capabilities/dating.py diff --git a/weboob/capabilities/dating.py b/weboob/capabilities/dating.py new file mode 100644 index 00000000..30fd66b0 --- /dev/null +++ b/weboob/capabilities/dating.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- + +""" +Copyright(C) 2010 Romain Bignon + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 3 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +""" + +from .cap import ICap + +class Profile(object): + def get_profile_text(self): + body = u'Status: %s' % unicode(self.status) + if self.photos: + body += u'\nPhotos:' + for photo in self.photos: + body += u'\n\t\t%s' % unicode(photo) + body += u'\nStats:' + for label, value in self.get_stats().iteritems(): + body += u'\n\t\t%-15s %s' % (label + ':', value) + body += u'\n\nInformations:' + for section, d in self.get_table().iteritems(): + body += u'\n\t%s\n' % section + for key, value in d.items(): + key = '%s:' % key + if isinstance(value, list): + body += u'\t\t%-15s %s\n' % (key, u', '.join([unicode(s) for s in value])) + elif isinstance(value, float): + body += u'\t\t%-15s %.2f\n' % (key, value) + else: + body += u'\t\t%-15s %s\n' % (key, unicode(value)) + body += u'\n\nDescription:\n%s' % unicode(self.get_description()) + + return body + +class ICapDating(ICap): + def get_profile(self, _id): + raise NotImplementedError() + + def start_profile_walker(self): + raise NotImplementedError()