Esempio n. 1
0
File: pods.py Progetto: drGrove/grow
    def __init__(self, root, storage=grow_storage.auto, env=None, load_extensions=True):
        self._yaml = utils.SENTINEL
        self.storage = storage
        self.root = (root if self.storage.is_cloud_storage
                     else os.path.abspath(root))
        self.env = (env if env
                    else environment.Env(environment.EnvConfig(host='localhost')))
        self.locales = locales.Locales(pod=self)
        self.catalogs = catalog_holder.Catalogs(pod=self)
        self.routes = grow_routes.Routes(pod=self)
        self._podcache = None
        self._disabled = set(
            self.FEATURE_TRANSLATION_STATS,
        )

        # Ensure preprocessors are loaded when pod is initialized.
        # Preprocessors may modify the environment in ways that are required by
        # data files (e.g. yaml constructors). Avoid loading extensions using
        # `load_extensions=False` to permit `grow install` to be used to
        # actually install extensions, prior to loading them.
        if load_extensions and self.exists:
            # Modify sys.path for built-in extension support.
            _ext_dir = self.abs_path(self.extensions_dir)
            if os.path.exists(_ext_dir):
                sys.path.insert(0, _ext_dir)
            self.list_preprocessors()
        try:
            sdk_utils.check_sdk_version(self)
        except PodDoesNotExistError:
            pass  # Pod doesn't exist yet, simply pass.
Esempio n. 2
0
    def __init__(self,
                 root,
                 storage=storage.auto,
                 env=None,
                 load_extensions=True):
        self._yaml = utils.SENTINEL
        self.storage = storage
        self.root = (root if self.storage.is_cloud_storage else
                     os.path.abspath(root))
        self.env = (env if env else environment.Env(
            environment.EnvConfig(host='localhost')))
        self.locales = locales.Locales(pod=self)
        self.catalogs = catalog_holder.Catalogs(pod=self)
        self.routes = routes.Routes(pod=self)
        self._podcache = None
        self._disabled = set()

        # Ensure preprocessors are loaded when pod is initialized.
        # Preprocessors may modify the environment in ways that are required by
        # data files (e.g. yaml constructors). Avoid loading extensions using
        # `load_extensions=False` to permit `grow install` to be used to
        # actually install extensions, prior to loading them.
        if load_extensions and self.exists:
            # Modify sys.path for built-in extension support.
            _ext_dir = self.abs_path(self.extensions_dir)
            if os.path.exists(_ext_dir):
                sys.path.insert(0, _ext_dir)
            self.list_preprocessors()
        try:
            sdk_utils.check_sdk_version(self)
        except PodDoesNotExistError:
            pass  # Pod doesn't exist yet, simply pass.
Esempio n. 3
0
 def __init__(self, root, storage=storage.auto, env=None):
     self.storage = storage
     self.root = root if self.storage.is_cloud_storage else os.path.abspath(root)
     self.env = env if env else environment.Env(environment.EnvConfig(host="localhost"))
     self.locales = locales.Locales(pod=self)
     self.catalogs = catalog_holder.Catalogs(pod=self)
     self.logger = _logger
     self.routes = routes.Routes(pod=self)
     try:
         sdk_utils.check_sdk_version(self)
     except PodDoesNotExistError:
         pass  # Pod doesn't exist yet, simply pass.
Esempio n. 4
0
  def __init__(self, root, storage=storage.auto, env=None):
    self.storage = storage
    self.root = root if self.storage.is_cloud_storage else os.path.abspath(root)
    self.env = env if env else environment.Env(environment.EnvConfig(host='localhost'))

    self.locales = locales.Locales(pod=self)
    self.tests = tests.Tests(pod=self)
    self.catalogs = catalog_holder.Catalogs(pod=self)

    self.logger = _logger
    self._routes = None
    sdk_utils.check_sdk_version(self)
Esempio n. 5
0
 def __init__(self, root, storage=storage.auto, env=None):
     self.virtual_files = {}
     self.storage = storage
     self.root = (root if self.storage.is_cloud_storage else
                  os.path.abspath(root))
     self.env = (env if env else environment.Env(
         environment.EnvConfig(host='localhost')))
     self.locales = locales.Locales(pod=self)
     self.catalogs = catalog_holder.Catalogs(pod=self)
     self.logger = _logger
     self.routes = routes.Routes(pod=self)
     try:
         sdk_utils.check_sdk_version(self)
     except PodDoesNotExistError:
         pass  # Pod doesn't exist yet, simply pass.
Esempio n. 6
0
    def __init__(self, root, storage=storage.auto, env=None):
        self.storage = storage
        self.root = (root if self.storage.is_cloud_storage
                     else os.path.abspath(root))
        self.env = (env if env
                    else environment.Env(environment.EnvConfig(host='localhost')))
        self.locales = locales.Locales(pod=self)
        self.catalogs = catalog_holder.Catalogs(pod=self)
        self.logger = _logger
        self.routes = routes.Routes(pod=self)
        self._podcache = None
        self._disabled = set()

        # Ensure preprocessors are loaded when pod is initialized.
        # Preprocessors may modify the environment in ways that are required by
        # data files (e.g. yaml constructors).
        if self.exists:
            self.list_preprocessors()
        try:
            sdk_utils.check_sdk_version(self)
        except PodDoesNotExistError:
            pass  # Pod doesn't exist yet, simply pass.