rev242, Implicit SSL support for the future, Exist typo fix

This commit is contained in:
HelloZeroNet 2015-06-17 00:49:46 +02:00
parent ea921e4ad7
commit b2e2453e58
12 changed files with 51 additions and 37 deletions

View file

@ -325,7 +325,7 @@ class Site:
self.log.debug("Cloning to %s, ignore dirs: %s" % (address, default_dirs))
# Copy root content.json
if not new_site.storage.isFile("content.json") and not overwrite: # Content.json not exits yet, create a new one from source site
if not new_site.storage.isFile("content.json") and not overwrite: # Content.json not exist yet, create a new one from source site
content_json = self.storage.loadJson("content.json")
del content_json["domain"]
content_json["title"] = "my"+content_json["title"]
@ -355,7 +355,7 @@ class Site:
if "-default" in file_inner_path:
file_path_dest = new_site.storage.getPath(file_inner_path.replace("-default", ""))
if new_site.storage.isFile(file_path_dest) and not overwrite: # Don't overwrite site files with default ones
self.log.debug("[SKIP] Default file: %s (already exits)" % file_inner_path)
self.log.debug("[SKIP] Default file: %s (already exist)" % file_inner_path)
continue
self.log.debug("[COPY] Default file: %s to %s..." % (file_inner_path, file_path_dest))
dest_dir = os.path.dirname(file_path_dest)
@ -376,9 +376,9 @@ class Site:
return new_site
# Check and download if file not exits
# Check and download if file not exist
def needFile(self, inner_path, update=False, blocking=True, peer=None, priority=0):
if self.storage.isFile(inner_path) and not update: # File exits, no need to do anything
if self.storage.isFile(inner_path) and not update: # File exist, no need to do anything
return True
elif self.settings["serving"] == False: # Site not serving
return False

View file

@ -67,7 +67,7 @@ class SiteManager(object):
from Site import Site
new = False
site = self.get(address)
if not site: # Site not exits yet
if not site: # Site not exist yet
if not self.isAddress(address): return False # Not address: %s % address
logging.debug("Added new site: %s" % address)
site = Site(address)

View file

@ -27,7 +27,7 @@ class SiteStorage:
schema = self.loadJson("dbschema.json")
db_path = self.getPath(schema["db_file"])
if check:
if not os.path.isfile(db_path) or os.path.getsize(db_path) == 0: # Not exits or null
if not os.path.isfile(db_path) or os.path.getsize(db_path) == 0: # Not exist or null
self.rebuildDb()
self.db = Db(schema, db_path)
if check and not self.db_checked:
@ -46,7 +46,7 @@ class SiteStorage:
if not self.db:
self.log.debug("No database, waiting for dbschema.json...")
self.site.needFile("dbschema.json", priority=1)
self.has_db = self.isFile("dbschema.json") # Recheck if dbschema exits
self.has_db = self.isFile("dbschema.json") # Recheck if dbschema exist
if self.has_db: self.openDb()
return self.db
@ -125,7 +125,7 @@ class SiteStorage:
# Write content to file
def write(self, inner_path, content):
file_path = self.getPath(inner_path)
# Create dir if not exits
# Create dir if not exist
file_dir = os.path.dirname(file_path)
if not os.path.isdir(file_dir):
os.makedirs(file_dir)
@ -182,12 +182,12 @@ class SiteStorage:
return os.path.getsize(self.getPath(inner_path))
# File exits
# File exist
def isFile(self, inner_path):
return os.path.isfile(self.getPath(inner_path))
# Dir exits
# Dir exist
def isDir(self, inner_path):
return os.path.isdir(self.getPath(inner_path))