| 22 | @PluginManager.acceptPlugins |
| 23 | class 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"): |