| from core.models import Site |
| db_sites = Site.objects.all() |
| self.local_sites[db_site.login_base] = db_site |
| print "%s local sites" % len(db_sites) |
| sites = self.api.GetSites({'peer_id': None}) |
| print "%s remote sites" % len(sites) |
| self.remote_sites[site['site_id']] = site |
| if site['login_base'] not in self.local_sites: |
| new_site = Site(name=site['name'], |
| login_base=site['login_base'], |
| longitude=site['longitude'], |
| latitude=site['latitude'], |
| is_public=site['is_public'], |
| abbreviated_name=site['abbreviated_name']) |
| self.local_sites[new_site.login_base] = new_site |
| print "imported %s sites" % count |