当前位置: 首页>>代码示例>>Python>>正文


Python Pool._get_installed_module_directories方法代码示例

本文整理汇总了Python中trytond.pool.Pool._get_installed_module_directories方法的典型用法代码示例。如果您正苦于以下问题:Python Pool._get_installed_module_directories方法的具体用法?Python Pool._get_installed_module_directories怎么用?Python Pool._get_installed_module_directories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在trytond.pool.Pool的用法示例。


在下文中一共展示了Pool._get_installed_module_directories方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _clean_nereid

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import _get_installed_module_directories [as 别名]
    def _clean_nereid(translation):
        """
        Remove the nereid translations if the module is not installed
        """
        TranslationSet = Pool().get('ir.translation.set', type='wizard')
        installed_modules = TranslationSet._get_installed_module_directories()

        # Clean if the module is not installed anymore
        for module, directory in installed_modules:
            if translation.module == module:
                break
        else:
            return True

        # Clean any messages from tests
        if 'tests' in translation.name.split('/'):
            return True

        # Clean if the translation has changed (avoid duplicates)
        # (translation has no equivalent in template)
        babel_file = os.path.join(directory, translation.name)
        if not os.path.exists(babel_file):
            return True
        found = False
        for template, lineno, message in \
            TranslationSet._get_babel_messages_from_file(TranslationSet,
                babel_file):
            if (lineno, message) == (translation.res_id, translation.src):
                found = True
                break
        if not found:
            return True
开发者ID:priyankajain18,项目名称:nereid,代码行数:34,代码来源:translation.py

示例2: _clean_nereid

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import _get_installed_module_directories [as 别名]
    def _clean_nereid(translation):
        """
        Remove the nereid translations if the module is not installed
        """
        TranslationSet = Pool().get('ir.translation.set', type='wizard')
        installed_modules = TranslationSet._get_installed_module_directories()

        # Clean if the module is not installed anymore
        for module, directory in installed_modules:
            if translation.module == module:
                break
        else:
            return True
开发者ID:GauravButola,项目名称:nereid,代码行数:15,代码来源:translation.py

示例3: _clean_nereid_template

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import _get_installed_module_directories [as 别名]
    def _clean_nereid_template(translation):
        """
        Clean the template translations if the module is not installed, or if
        the template is not there.
        """
        TranslationSet = Pool().get('ir.translation.set', type='wizard')
        installed_modules = TranslationSet._get_installed_module_directories()

        # Clean if the module is not installed anymore
        for module, directory in installed_modules:
            if translation.module == module:
                break
        else:
            return True

        # Clean if the template directory does not exist
        template_dir = os.path.join(directory, 'templates')
        if not os.path.isdir(template_dir):
            return True

        # Clean if the template is not found
        loader = FileSystemLoader(template_dir)
        if translation.name not in loader.list_templates():
            return True

        # Clean if the translation has changed (avoid duplicates)
        # (translation has no equivalent in template)
        found = False
        for template, lineno, function, message, comments in \
            TranslationSet._get_nereid_template_messages_from_file(
                TranslationSet, template_dir, translation.name):
            if (template, lineno, message, comments and
                    '\n'.join(comments) or None) == \
                (translation.name, translation.res_id, translation.src,
                    translation.comments):
                found = True
                break
        if not found:
            return True
开发者ID:priyankajain18,项目名称:nereid,代码行数:41,代码来源:translation.py

示例4: _clean_nereid_template

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import _get_installed_module_directories [as 别名]
    def _clean_nereid_template(translation):
        """
        Clean the template translations if the module is not installed, or if
        the template is not there.
        """
        TranslationSet = Pool().get('ir.translation.set', type='wizard')
        installed_modules = TranslationSet._get_installed_module_directories()

        # Clean if the module is not installed anymore
        for module, directory in installed_modules:
            if translation.module == module:
                break
        else:
            return True

        # Clean if the template directory does not exist
        template_dir = os.path.join(directory, 'templates')
        if not os.path.isdir(template_dir):
            return True

        # Clean if the template is not found
        loader = FileSystemLoader(template_dir)
        if translation.name not in loader.list_templates():
            return True
开发者ID:GauravButola,项目名称:nereid,代码行数:26,代码来源:translation.py


注:本文中的trytond.pool.Pool._get_installed_module_directories方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。