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


Python Revision.set方法代码示例

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


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

示例1: handle

# 需要导入模块: from pootle.core.models import Revision [as 别名]
# 或者: from pootle.core.models.Revision import set [as 别名]
    def handle(self, **options):
        if (not options['flush_rqdata'] and
            not options['flush_lru'] and
            not options['flush_django_cache'] and
            not options['flush_all']):
            raise CommandError("No options were provided. Use one of "
                               "--django-cache, --rqdata, --lru "
                               "or --all.")

        self.stdout.write('Flushing cache...')

        if options['flush_rqdata'] or options['flush_all']:
            # Flush all rq data, dirty counter and restore Pootle revision
            # value.
            r_con = get_redis_connection('redis')
            r_con.flushdb()
            self.stdout.write('RQ data removed.')
            Revision.set(Unit.max_revision())
            self.stdout.write('Max unit revision restored.')

        if options['flush_django_cache'] or options['flush_all']:
            r_con = get_redis_connection('default')
            r_con.flushdb()
            self.stdout.write('All default Django cache data removed.')

        if options['flush_lru'] or options['flush_all']:
            r_con = get_redis_connection('lru')
            r_con.flushdb()
            self.stdout.write('All lru cache data removed.')
开发者ID:ainslied,项目名称:pootle,代码行数:31,代码来源:flush_cache.py

示例2: handle_noargs

# 需要导入模块: from pootle.core.models import Revision [as 别名]
# 或者: from pootle.core.models.Revision import set [as 别名]
    def handle_noargs(self, **options):
        if options["restore"]:
            from pootle_store.models import Unit

            Revision.set(Unit.max_revision())

        self.stdout.write("%s" % Revision.get())
开发者ID:likulogy,项目名称:pootle,代码行数:9,代码来源:revision.py

示例3: fs_plugin_base

# 需要导入模块: from pootle.core.models import Revision [as 别名]
# 或者: from pootle.core.models.Revision import set [as 别名]
def fs_plugin_base(tutorial, tmpdir, settings, system, english, zulu):
    from django.core.cache import caches

    import pootle_fs_pytest

    from pootle.core.models import Revision
    from pootle_store.models import Unit

    caches["exports"].clear()

    Revision.set(Unit.max_revision())

    dir_path = str(tmpdir.dirpath())
    repo_path = os.path.join(dir_path, "__src__")
    src_path = os.path.abspath(
        os.path.join(
            os.path.dirname(pootle_fs_pytest.__file__),
            "data/fs/example_fs"))
    settings.POOTLE_FS_PATH = dir_path
    tutorial_path = os.path.join(dir_path, tutorial.code)
    if os.path.exists(tutorial_path):
        shutil.rmtree(tutorial_path)
    if os.path.exists(repo_path):
        shutil.rmtree(repo_path)
    return tutorial, src_path, repo_path, dir_path
开发者ID:ta2-1,项目名称:pootle_fs,代码行数:27,代码来源:plugin.py

示例4: revision

# 需要导入模块: from pootle.core.models import Revision [as 别名]
# 或者: from pootle.core.models.Revision import set [as 别名]
def revision(request, clear_cache):
    """Sets up the cached revision counter for each test call."""
    from pootle.core.models import Revision
    from pootle_store.models import Unit

    if request.node.get_marker("django_db"):
        Revision.set(Unit.max_revision())
    else:
        Revision.initialize()
开发者ID:AshishNamdev,项目名称:pootle,代码行数:11,代码来源:revision.py

示例5: handle

# 需要导入模块: from pootle.core.models import Revision [as 别名]
# 或者: from pootle.core.models.Revision import set [as 别名]
    def handle(self, **options):
        if options['restore']:
            from pootle_store.models import Unit
            Revision.set(Unit.max_revision())

        self.stdout.write('%s' % Revision.get())
开发者ID:AlfredWei,项目名称:pootle,代码行数:8,代码来源:revision.py


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