Exemplo n.º 1
0
 def _on_my_dht_relations_discovered(self, dht_result):
     if not (dht_result and isinstance(dht_result, dict)
             and len(dht_result.get('suppliers', [])) > 0):
         lg.warn('no dht records found for my customer family')
         self.automat('suppliers-read-failed')
         return
     dht_suppliers = id_url.to_bin_list(dht_result['suppliers'])
     dht_ecc_map = dht_result.get('ecc_map', settings.DefaultEccMapName())
     try:
         dht_desired_suppliers_number = eccmap.GetEccMapSuppliersNumber(
             dht_ecc_map)
     except:
         lg.exc()
         dht_desired_suppliers_number = eccmap.GetEccMapSuppliersNumber(
             settings.DefaultEccMapName())
     settings.config.conf().setInt('services/customer/suppliers-number',
                                   dht_desired_suppliers_number)
     contactsdb.set_suppliers(dht_suppliers)
     contactsdb.save_suppliers()
     lg.info('found and restored list of %d suppliers from DHT' %
             dht_desired_suppliers_number)
     self.automat('suppliers-read-ok')
Exemplo n.º 2
0
def DefaultName():
    """
    This is a wrapper for ``settings.DefaultEccMapName``.
    """
    from main import settings
    return settings.DefaultEccMapName()