예제 #1
0
파일: pods.py 프로젝트: cdhermann/grow
    def __init__(self,
                 root,
                 storage=grow_storage.AUTO,
                 env=None,
                 load_extensions=True):
        self.deprecated = deprecated.DeprecationManager(self.logger.warn)
        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._jinja_env_lock = threading.RLock()
        self._podcache = None
        self._features = features.Features(disabled=[
            self.FEATURE_TRANSLATION_STATS,
            self.FEATURE_OLD_SLUGIFY,
        ])
        self._experiments = features.Features(default_enabled=False)

        self._extensions_controller = ext_controller.ExtensionController(self)

        if 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)

            # Load the features from the podspec.
            self._load_features()

            # Load the experiments from the podspec.
            self._load_experiments()

        # 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:
            self.list_preprocessors()

        # Load extensions, ignore local extensions during install.
        self._load_extensions(load_extensions)

        try:
            update_checker = updater.Updater(self)
            update_checker.verify_required_version()
        except PodDoesNotExistError:
            pass  # Pod doesn't exist yet, simply pass.
예제 #2
0
파일: pods.py 프로젝트: david-j-davis/grow
 def get_catalogs(self, template_path=None):
     return catalog_holder.Catalogs(pod=self, template_path=template_path)