MCPcopy Index your code
hub / github.com/HelloZeroNet/ZeroNet / __init__

Method __init__

src/Site/SiteStorage.py:24–38  ·  view source on GitHub ↗
(self, site, allow_create=True)

Source from the content-addressed store, hash-verified

22@PluginManager.acceptPlugins
23class SiteStorage(object):
24 def __init__(self, site, allow_create=True):
25 self.site = site
26 self.directory = "%s/%s" % (config.data_dir, self.site.address) # Site data diretory
27 self.allowed_dir = os.path.abspath(self.directory) # Only serve file within this dir
28 self.log = site.log
29 self.db = None # Db class
30 self.db_checked = False # Checked db tables since startup
31 self.event_db_busy = None # Gevent AsyncResult if db is working on rebuild
32 self.has_db = self.isFile("dbschema.json") # The site has schema
33
34 if not os.path.isdir(self.directory):
35 if allow_create:
36 os.mkdir(self.directory) # Create directory if not found
37 else:
38 raise Exception("Directory not exists: %s" % self.directory)
39
40 def getDbFile(self):
41 if self.isFile("dbschema.json"):

Callers

nothing calls this directly

Calls 1

isFileMethod · 0.95

Tested by

no test coverage detected