python类ChoiceLoader()的实例源码

templating.py 文件源码 项目:charm-plumgrid-gateway 作者: openstack 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            apt_install('python-jinja2')
templating.py 文件源码 项目:charm-heat 作者: openstack 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-keystone 作者: openstack 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-keystone 作者: openstack 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-keystone 作者: openstack 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-nova-cloud-controller 作者: openstack 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-nova-compute 作者: openstack 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-glance 作者: openstack 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-glance 作者: openstack 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-glance 作者: openstack 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-neutron-api 作者: openstack 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-ceph-mon 作者: openstack 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-openstack-dashboard 作者: openstack 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-ceilometer 作者: openstack 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-ceilometer 作者: openstack 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-neutron-openvswitch 作者: openstack 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-cinder-backup 作者: openstack 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
__init__.py 文件源码 项目:crm 作者: Incubaid 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def register_template_dirs(self):
        """
        Go Through all sub applications under (crm) and if a dir called (templates)
        found, register it as a template directory
        """
        template_dirs = []
        for root, dirs, _ in os.walk('crm'):
            for dir in dirs:
                if not dir == 'templates':
                    continue
                template_dirs.append(os.path.abspath(os.path.join(root, dir)))
        template_loader = jinja2.ChoiceLoader([
            self._app.jinja_loader,
            jinja2.FileSystemLoader(template_dirs),
        ]
        )
        self._app.jinja_loader = template_loader
templating.py 文件源码 项目:charm-odl-controller 作者: openstack 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-ceph-radosgw 作者: openstack 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-swift-storage 作者: openstack 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-swift-storage 作者: openstack 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-swift-storage 作者: openstack 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:equlipse 作者: konono 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:equlipse 作者: konono 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:equlipse 作者: konono 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-rabbitmq-server 作者: openstack 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
core.py 文件源码 项目:flask-ask 作者: johnwheeler 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def init_blueprint(self, blueprint, path='templates.yaml'):
        """Initialize a Flask Blueprint, similar to init_app, but without the access
        to the application config.

        Keyword Arguments:
            blueprint {Flask Blueprint} -- Flask Blueprint instance to initialize (Default: {None})
            path {str} -- path to templates yaml file, relative to Blueprint (Default: {'templates.yaml'})
        """
        if self._route is not None:
            raise TypeError("route cannot be set when using blueprints!")

        # we need to tuck our reference to this Ask instance into the blueprint object and find it later!
        blueprint.ask = self

        # BlueprintSetupState.add_url_rule gets called underneath the covers and
        # concats the rule string, so we should set to an empty string to allow
        # Blueprint('blueprint_api', __name__, url_prefix="/ask") to result in
        # exposing the rule at "/ask" and not "/ask/".
        blueprint.add_url_rule("", view_func=self._flask_view_func, methods=['POST'])
        blueprint.jinja_loader = ChoiceLoader([YamlLoader(blueprint, path)])
templating.py 文件源码 项目:charm-cinder 作者: openstack 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')
templating.py 文件源码 项目:charm-cinder-ceph 作者: openstack 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, templates_dir, openstack_release):
        if not os.path.isdir(templates_dir):
            log('Could not locate templates dir %s' % templates_dir,
                level=ERROR)
            raise OSConfigException

        self.templates_dir = templates_dir
        self.openstack_release = openstack_release
        self.templates = {}
        self._tmpl_env = None

        if None in [Environment, ChoiceLoader, FileSystemLoader]:
            # if this code is running, the object is created pre-install hook.
            # jinja2 shouldn't get touched until the module is reloaded on next
            # hook execution, with proper jinja2 bits successfully imported.
            if six.PY2:
                apt_install('python-jinja2')
            else:
                apt_install('python3-jinja2')


问题


面经


文章

微信
公众号

扫码关注公众号