def get_peers(self): """returns Peers""" # lazy initialisation if self.peers != {}: return ContactsMixin.get_peers(self) # full init if not self.config.has_section(SECTION_OTHERS): self.config.add_section(SECTION_OTHERS) options = self.config.options(SECTION_OTHERS) for peer_id in options: # check unicode if isinstance(peer_id, str): peer_id = unicode(peer_id, self.encoding) # get info description = self.config.get(SECTION_OTHERS, peer_id) try: pseudo, state, timestamp = description.split(',') peer_desc = PeerDescriptor(peer_id, state=state) ContactsMixin.set_peer(self, peer_id, peer_desc) peer_desc.load() # TODO: use timestamp except Exception, error: print error, ": peer %s not retreived"% description
def reset_peers(self): """empty all information concerning peers""" ContactsMixin.reset_peers(self) self.config.remove_section(SECTION_OTHERS) self.config.add_section(SECTION_OTHERS)
def import_document(self, other_document): """copy data from another document into self""" CachePersonalMixin.import_document(self, other_document) FileSharingMixin.import_document(self, other_document) ContactsMixin.import_document(self, other_document)
def __init__(self): self.config.add_section(SECTION_OTHERS) ContactsMixin.__init__(self)
def __init__(self): CachePersonalMixin.__init__(self) FileSharingMixin.__init__(self) ContactsMixin.__init__(self) SaverMixin.__init__(self)