Merge pull request #207 from zeronet-conservancy/fix_site_import

revert circular import style in Site/SiteManager
This commit is contained in:
caryoscelus 2023-03-21 12:02:59 +00:00 committed by GitHub
commit ddde202879
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,7 +14,6 @@ from Config import config
from util import helper from util import helper
from util import RateLimit from util import RateLimit
from util import Cached from util import Cached
from .Site import Site
from Debug import Debug from Debug import Debug
@PluginManager.acceptPlugins @PluginManager.acceptPlugins
@ -31,6 +30,7 @@ class SiteManager(object):
# Load all sites from data/sites.json # Load all sites from data/sites.json
@util.Noparallel() @util.Noparallel()
def load(self, cleanup=True, startup=False): def load(self, cleanup=True, startup=False):
from .Site import Site
self.log.info("Loading sites... (cleanup: %s, startup: %s)" % (cleanup, startup)) self.log.info("Loading sites... (cleanup: %s, startup: %s)" % (cleanup, startup))
self.loaded = False self.loaded = False
address_found = [] address_found = []
@ -169,6 +169,7 @@ class SiteManager(object):
return site return site
def add(self, address, all_file=True, settings=None, **kwargs): def add(self, address, all_file=True, settings=None, **kwargs):
from .Site import Site
self.sites_changed = int(time.time()) self.sites_changed = int(time.time())
# Try to find site with differect case # Try to find site with differect case
for recover_address, recover_site in list(self.sites.items()): for recover_address, recover_site in list(self.sites.items()):