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


Python util.add_configuration_error函数代码示例

本文整理汇总了Python中weblate.trans.util.add_configuration_error函数的典型用法代码示例。如果您正苦于以下问题:Python add_configuration_error函数的具体用法?Python add_configuration_error怎么用?Python add_configuration_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: is_supported

 def is_supported(cls):
     """
     Checks whether this VCS backend is supported.
     """
     if cls._is_supported is not None:
         return cls._is_supported
     try:
         version = cls.get_version()
     except OSError:
         cls._is_supported = False
         return False
     if cls.req_version is None:
         cls._is_supported = True
     elif LooseVersion(version) >= cls.req_version:
         cls._is_supported = True
     else:
         cls._is_supported = False
         add_configuration_error(
             cls.name.lower(),
             '{0} version is too old, please upgrade to {1}.'.format(
                 cls.name,
                 cls.req_version
             )
         )
     return cls._is_supported
开发者ID:Saectar,项目名称:weblate,代码行数:25,代码来源:vcs.py

示例2: test_error

 def test_error(self):
     add_configuration_error('Test error', 'FOOOOOOOOOOOOOO')
     response = self.client.get(reverse('admin:performance'))
     self.assertContains(response, 'FOOOOOOOOOOOOOO')
     delete_configuration_error('Test error')
     response = self.client.get(reverse('admin:performance'))
     self.assertNotContains(response, 'FOOOOOOOOOOOOOO')
开发者ID:dekoza,项目名称:weblate,代码行数:7,代码来源:tests.py

示例3: test_configuration_health_check

 def test_configuration_health_check(self):
     add_configuration_error('TEST', 'Message', True)
     add_configuration_error('TEST2', 'Message', True)
     configuration_health_check(False)
     self.assertEqual(ConfigurationError.objects.count(), 2)
     delete_configuration_error('TEST2', True)
     configuration_health_check(False)
     self.assertEqual(ConfigurationError.objects.count(), 1)
     configuration_health_check()
开发者ID:dekoza,项目名称:weblate,代码行数:9,代码来源:tests.py

示例4: register_fileformat

def register_fileformat(fileformat):
    """
    Registers fileformat in dictionary.
    """
    try:
        fileformat.get_class()
        FILE_FORMATS[fileformat.format_id] = fileformat
    except (AttributeError, ImportError):
        add_configuration_error("File format: {0}".format(fileformat.format_id), traceback.format_exc())
    return fileformat
开发者ID:nblock,项目名称:weblate,代码行数:10,代码来源:formats.py

示例5: register_fileformat

def register_fileformat(fileformat):
    """Register fileformat in dictionary."""
    try:
        fileformat.get_class()
        FILE_FORMATS[fileformat.format_id] = fileformat
        for autoload in fileformat.autoload:
            FILE_DETECT.append((autoload, fileformat))
    except (AttributeError, ImportError):
        add_configuration_error(
            'File format: {0}'.format(fileformat.format_id),
            traceback.format_exc()
        )
    return fileformat
开发者ID:saily,项目名称:weblate,代码行数:13,代码来源:formats.py

示例6: load_data

    def load_data(self):
        result = super(FileFormatLoader, self).load_data()

        for fileformat in list(result.values()):
            try:
                fileformat.get_class()
            except (AttributeError, ImportError):
                add_configuration_error(
                    'File format: {0}'.format(fileformat.format_id),
                    traceback.format_exc()
                )
                result.pop(fileformat.format_id)

        return result
开发者ID:daleathan,项目名称:weblate,代码行数:14,代码来源:models.py

示例7: load_data

    def load_data(self):
        result = super(FileFormatLoader, self).load_data()

        for fileformat in list(result.values()):
            error_name = 'File format: {0}'.format(fileformat.format_id)
            try:
                fileformat.get_class()
                delete_configuration_error(error_name)
            except (AttributeError, ImportError) as error:
                result.pop(fileformat.format_id)
                if fileformat.format_id == 'rc' and six.PY3:
                    continue
                add_configuration_error(error_name, str(error))

        return result
开发者ID:dekoza,项目名称:weblate,代码行数:15,代码来源:models.py

示例8: ready

    def ready(self):
        # Configure merge driver for Gettext PO
        try:
            GitRepository.global_setup()
        except RepositoryException as error:
            add_configuration_error("Git global setup", "Failed to do git setup: {0}".format(error))

        # Use it for *.po by default
        configdir = os.path.join(data_dir("home"), ".config", "git")
        configfile = os.path.join(configdir, "attributes")
        if not os.path.exists(configfile):
            if not os.path.exists(configdir):
                os.makedirs(configdir)
            with open(configfile, "w") as handle:
                handle.write("*.po merge=weblate-merge-gettext-po\n")
开发者ID:nijel,项目名称:weblate,代码行数:15,代码来源:apps.py

示例9: ready

    def ready(self):
        # Configure merge driver for Gettext PO
        try:
            GitRepository.global_setup()
        except RepositoryException as error:
            add_configuration_error(
                'Git global setup',
                'Failed to do git setup: {0}'.format(error)
            )

        # Use it for *.po by default
        configdir = os.path.join(data_dir('home'), '.config', 'git')
        configfile = os.path.join(configdir, 'attributes')
        if not os.path.exists(configfile):
            if not os.path.exists(configdir):
                os.makedirs(configdir)
            with open(configfile, 'w') as handle:
                handle.write('*.po merge=weblate-merge-gettext-po\n')
开发者ID:saily,项目名称:weblate,代码行数:18,代码来源:apps.py

示例10: generate_gpg_key

def generate_gpg_key():
    try:
        subprocess.check_output(
            [
                'gpg',
                '--batch',
                '--pinentry-mode', 'loopback',
                '--passphrase', '',
                '--quick-generate-key',
                settings.WEBLATE_GPG_IDENTITY,
                settings.WEBLATE_GPG_ALGO,
                'default', 'never',
            ],
            stderr=subprocess.STDOUT,
            env=get_clean_env(),
        )
        return get_gpg_key()
    except (subprocess.CalledProcessError, OSError) as exc:
        add_configuration_error('GPG key generating', force_text(exc))
        return None
开发者ID:daleathan,项目名称:weblate,代码行数:20,代码来源:gpg.py

示例11: get_gpg_key

def get_gpg_key(silent=False):
    try:
        output = subprocess.check_output(
            [
                'gpg',
                '--batch',
                '--with-colons',
                '--list-secret-keys',
                settings.WEBLATE_GPG_IDENTITY,
            ],
            stderr=subprocess.STDOUT,
            env=get_clean_env(),
        ).decode('utf-8')
        for line in output.splitlines():
            if not line.startswith('fpr:'):
                continue
            return line.split(':')[9]
        return None
    except (subprocess.CalledProcessError, OSError) as exc:
        if not silent:
            add_configuration_error('GPG key listing', force_text(exc))
        return None
开发者ID:daleathan,项目名称:weblate,代码行数:22,代码来源:gpg.py

示例12: get_gpg_public_key

def get_gpg_public_key():
    key = get_gpg_sign_key()
    if key is None:
        return None
    data = cache.get('gpg-key-public')
    if not data:
        try:
            data = subprocess.check_output(
                [
                    'gpg',
                    '--batch',
                    '-armor',
                    '--export',
                    key,
                ],
                stderr=subprocess.STDOUT,
                env=get_clean_env(),
            ).decode('utf-8')
            cache.set('gpg-key-public', data, 7 * 86400)
        except (subprocess.CalledProcessError, OSError) as exc:
            add_configuration_error('GPG key public', force_text(exc))
            return None
    return data
开发者ID:daleathan,项目名称:weblate,代码行数:23,代码来源:gpg.py

示例13: is_supported

 def is_supported(cls):
     """Check whether this VCS backend is supported."""
     if cls._is_supported is not None:
         return cls._is_supported
     try:
         version = cls.get_version()
     except (OSError, RepositoryException):
         cls._is_supported = False
         return False
     if (cls.req_version is None or
             LooseVersion(version) >= LooseVersion(cls.req_version)):
         cls._is_supported = True
         delete_configuration_error(cls.name.lower())
     else:
         cls._is_supported = False
         add_configuration_error(
             cls.name.lower(),
             '{0} version is too old, please upgrade to {1}.'.format(
                 cls.name,
                 cls.req_version
             )
         )
     return cls._is_supported
开发者ID:nijel,项目名称:weblate,代码行数:23,代码来源:base.py

示例14: test_error

 def test_error(self):
     add_configuration_error("Test error", "FOOOOOOOOOOOOOO")
     response = self.client.get(reverse("admin-performance"))
     self.assertContains(response, "FOOOOOOOOOOOOOO")
开发者ID:beck,项目名称:weblate,代码行数:4,代码来源:test_admin.py


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