Rev448, Better file download priority method, Some potential programming error fix, Renamed utils to helper, Moved pack and unpackaddress to helper package, Test new privatekey creation, Test site file download order, Spy test helper to log called parameters, Remove unnecessary fat arrows

This commit is contained in:
HelloZeroNet 2015-09-27 02:08:53 +02:00
parent a891b544d3
commit 4b403da056
24 changed files with 221 additions and 226 deletions

View file

@ -24,7 +24,7 @@ from Debug import Debug
from Content import ContentManager
from SiteStorage import SiteStorage
from Crypt import CryptHash
from util import utils
from util import helper
import SiteManager
@ -92,7 +92,7 @@ class Site:
def saveSettings(self):
sites_settings = json.load(open("%s/sites.json" % config.data_dir))
sites_settings[self.address] = self.settings
utils.atomicWrite("%s/sites.json" % config.data_dir, json.dumps(sites_settings, indent=2, sort_keys=True))
helper.atomicWrite("%s/sites.json" % config.data_dir, json.dumps(sites_settings, indent=2, sort_keys=True))
# Max site size in MB
def getSizeLimit(self):
@ -172,7 +172,7 @@ class Site:
)
gevent.spawn(self.announce)
if check_size: # Check the size first
valid = self.downloadContent(download_files=False) # Just download content.json files
valid = self.downloadContent("content.json", download_files=False) # Just download content.json files
if not valid:
return False # Cant download content.jsons or size is not fits

View file

@ -57,7 +57,7 @@ class SiteStorage:
def getDb(self):
if not self.db:
self.log.debug("No database, waiting for dbschema.json...")
self.site.needFile("dbschema.json", priority=1)
self.site.needFile("dbschema.json", priority=3)
self.has_db = self.isFile("dbschema.json") # Recheck if dbschema exist
if self.has_db:
self.openDb()