• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python helper.get_subproject函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: push_subproject

def push_subproject(request, project, subproject):
    obj = get_subproject(request, project, subproject)

    if obj.do_push(request):
        messages.info(request, _('All repositories were pushed.'))

    return redirect(obj)
开发者ID:fluentglobe,项目名称:our,代码行数:7,代码来源:git.py


示例2: commit_subproject

def commit_subproject(request, project, subproject):
    obj = get_subproject(request, project, subproject)
    obj.commit_pending(request)

    messages.info(request, _('All pending translations were committed.'))

    return redirect(obj)
开发者ID:fluentglobe,项目名称:our,代码行数:7,代码来源:git.py


示例3: reset_subproject

def reset_subproject(request, project, subproject):
    obj = get_subproject(request, project, subproject)

    if obj.do_reset(request):
        messages.info(request, _('All repositories have been reset.'))

    return redirect(obj)
开发者ID:fluentglobe,项目名称:our,代码行数:7,代码来源:git.py


示例4: show_check_subproject

def show_check_subproject(request, name, project, subproject):
    '''
    Show checks failing in a subproject.
    '''
    subprj = get_subproject(request, project, subproject)
    try:
        check = CHECKS[name]
    except KeyError:
        raise Http404('No check matches the given query.')
    units = Unit.objects.none()
    if check.target:
        langs = Check.objects.filter(
            check=name,
            project=subprj.project,
            ignore=False
        ).values_list(
            'language', flat=True
        ).distinct()
        for lang in langs:
            checks = Check.objects.filter(
                check=name,
                project=subprj.project,
                language=lang,
                ignore=False
            ).values_list('checksum', flat=True)
            res = Unit.objects.filter(
                translation__subproject=subprj,
                checksum__in=checks,
                translation__language=lang,
                translated=True
            ).values(
                'translation__language__code'
            ).annotate(count=Count('id'))
            units |= res
    source_checks = []
    if check.source:
        checks = Check.objects.filter(
            check=name, project=subprj.project,
            language=None,
            ignore=False
        ).values_list('checksum', flat=True)
        lang = subprj.translation_set.all()[0].language
        res = Unit.objects.filter(
            translation__subproject=subprj,
            checksum__in=checks,
            translation__language=lang
        ).count()
        if res > 0:
            source_checks.append(res)
    return render_to_response(
        'check_subproject.html',
        RequestContext(request, {
            'checks': units,
            'source_checks': source_checks,
            'anychecks': len(units) + len(source_checks) > 0,
            'title': '%s/%s' % (subprj.__unicode__(), check.name),
            'check': check,
            'subproject': subprj,
        })
    )
开发者ID:kasunchathuranga,项目名称:weblate,代码行数:60,代码来源:checks.py


示例5: update_subproject

def update_subproject(request, project, subproject):
    obj = get_subproject(request, project, subproject)

    if obj.do_update(request):
        messages.info(request, _('All repositories were updated.'))

    return redirect(obj)
开发者ID:fluentglobe,项目名称:our,代码行数:7,代码来源:git.py


示例6: export_stats

def export_stats(request, project, subproject):
    """
    Exports stats in JSON format.
    """
    subprj = get_subproject(request, project, subproject)

    try:
        indent = int(request.GET["indent"])
    except:
        indent = None

    response = []
    for trans in subprj.translation_set.all():
        response.append(
            {
                "code": trans.language.code,
                "name": trans.language.name,
                "total": trans.total,
                "last_change": trans.get_last_change(),
                "last_author": trans.get_last_author(False),
                "translated": trans.translated,
                "translated_percent": trans.get_translated_percent(),
                "fuzzy": trans.fuzzy,
                "fuzzy_percent": trans.get_fuzzy_percent(),
                "failing": trans.get_failing_checks(),
                "failing_percent": trans.get_failing_checks_percent(),
                "url": trans.get_share_url(),
                "url_translate": get_site_url(trans.get_absolute_url()),
            }
        )
    return HttpResponse(json.dumps(response, default=json_dt_handler, indent=indent), mimetype="application/json")
开发者ID:ChrisOelmueller,项目名称:weblate,代码行数:31,代码来源:api.py


示例7: reset_subproject

def reset_subproject(request, project, subproject):
    obj = get_subproject(request, project, subproject)

    if obj.do_reset(request):
        messages.info(request, _('All repositories have been reset.'))

    return HttpResponseRedirect(obj.get_absolute_url())
开发者ID:ChrisOelmueller,项目名称:weblate,代码行数:7,代码来源:git.py


示例8: commit_subproject

def commit_subproject(request, project, subproject):
    obj = get_subproject(request, project, subproject)
    obj.commit_pending(request)

    messages.info(request, _('All pending translations were committed.'))

    return HttpResponseRedirect(obj.get_absolute_url())
开发者ID:ChrisOelmueller,项目名称:weblate,代码行数:7,代码来源:git.py


示例9: update_subproject

def update_subproject(request, project, subproject):
    obj = get_subproject(request, project, subproject)

    if obj.do_update(request):
        messages.info(request, _('All repositories were updated.'))

    return HttpResponseRedirect(obj.get_absolute_url())
开发者ID:ChrisOelmueller,项目名称:weblate,代码行数:7,代码来源:git.py


示例10: new_language

def new_language(request, project, subproject):
    obj = get_subproject(request, project, subproject)

    form = NewLanguageForm(request.POST)

    if form.is_valid():
        language = Language.objects.get(code=form.cleaned_data['lang'])
        same_lang = obj.translation_set.filter(language=language)
        if same_lang.exists():
            messages.error(
                request,
                _('Chosen translation already exists in this project!')
            )
        elif obj.project.new_lang == 'contact':
            notify_new_language(obj, language, request.user)
            messages.info(
                request,
                _(
                    "A request for a new translation has been "
                    "sent to the project's maintainers."
                )
            )
        elif obj.project.new_lang == 'add':
            obj.add_new_language(language, request)
    else:
        messages.error(
            request,
            _('Failed to process new translation request!')
        )

    return HttpResponseRedirect(reverse(
        'subproject',
        kwargs={'subproject': obj.slug, 'project': obj.project.slug}
    ))
开发者ID:thecantero,项目名称:weblate,代码行数:34,代码来源:basic.py


示例11: export_stats

def export_stats(request, project, subproject):
    """
    Exports stats in JSON format.
    """
    subprj = get_subproject(request, project, subproject)
    response = []
    site = Site.objects.get_current()
    for trans in subprj.translation_set.all():
        response.append(
            {
                "code": trans.language.code,
                "name": trans.language.name,
                "total": trans.total,
                "last_change": trans.get_last_change(),
                "last_author": trans.get_last_author(False),
                "translated": trans.translated,
                "translated_percent": trans.get_translated_percent(),
                "fuzzy": trans.fuzzy,
                "fuzzy_percent": trans.get_fuzzy_percent(),
                "failing": trans.get_failing_checks(),
                "failing_percent": trans.get_failing_checks_percent(),
                "url": trans.get_share_url(),
                "url_translate": "http://%s%s" % (site.domain, trans.get_absolute_url()),
            }
        )
    return HttpResponse(json.dumps(response, default=dt_handler), mimetype="application/json")
开发者ID:henricsson,项目名称:weblate,代码行数:26,代码来源:api.py


示例12: export_stats

def export_stats(request, project, subproject):
    '''
    Exports stats in JSON format.
    '''
    subprj = get_subproject(request, project, subproject)
    response = []
    for trans in subprj.translation_set.all():
        response.append({
            'code': trans.language.code,
            'name': trans.language.name,
            'total': trans.total,
            'last_change': trans.get_last_change(),
            'last_author': trans.get_last_author(False),
            'translated': trans.translated,
            'translated_percent': trans.get_translated_percent(),
            'fuzzy': trans.fuzzy,
            'fuzzy_percent': trans.get_fuzzy_percent(),
            'failing': trans.get_failing_checks(),
            'failing_percent': trans.get_failing_checks_percent(),
            'url': trans.get_share_url(),
            'url_translate': get_site_url(trans.get_absolute_url()),
        })
    return HttpResponse(
        json.dumps(response, default=dt_handler),
        mimetype='application/json'
    )
开发者ID:camilonova,项目名称:weblate,代码行数:26,代码来源:api.py


示例13: unlock_subproject

def unlock_subproject(request, project, subproject):
    obj = get_subproject(request, project, subproject)

    obj.locked = False
    obj.save()

    messages.info(request, _("Subproject is now open for translation updates."))

    return HttpResponseRedirect(obj.get_absolute_url())
开发者ID:kasunchathuranga,项目名称:weblate,代码行数:9,代码来源:lock.py


示例14: update_subproject

def update_subproject(request, project, subproject):
    '''
    API hook for updating git repos.
    '''
    if not appsettings.ENABLE_HOOKS:
        return HttpResponseNotAllowed([])
    obj = get_subproject(request, project, subproject, True)
    perform_update(obj)
    return HttpResponse('update triggered')
开发者ID:fluentglobe,项目名称:our,代码行数:9,代码来源:api.py


示例15: lock_subproject

def lock_subproject(request, project, subproject):
    obj = get_subproject(request, project, subproject)

    obj.commit_pending(request)

    obj.locked = True
    obj.save()

    messages.info(request, _("Subproject is now locked for translation updates!"))

    return HttpResponseRedirect(obj.get_absolute_url())
开发者ID:kasunchathuranga,项目名称:weblate,代码行数:11,代码来源:lock.py


示例16: unlock_subproject

def unlock_subproject(request, project, subproject):
    obj = get_subproject(request, project, subproject)

    obj.locked = False
    obj.save()

    messages.info(
        request,
        _('Subproject is now open for translation updates.')
    )

    return redirect(obj)
开发者ID:fluentglobe,项目名称:our,代码行数:12,代码来源:lock.py


示例17: update_subproject

def update_subproject(request, project, subproject):
    '''
    API hook for updating git repos.
    '''
    if not appsettings.ENABLE_HOOKS:
        return HttpResponseNotAllowed([])
    obj = get_subproject(request, project, subproject, True)
    if appsettings.BACKGROUND_HOOKS:
        thread = threading.Thread(target=obj.do_update)
        thread.start()
    else:
        obj.do_update()
    return HttpResponse('update triggered')
开发者ID:Marlinc,项目名称:weblate,代码行数:13,代码来源:api.py


示例18: lock_subproject

def lock_subproject(request, project, subproject):
    obj = get_subproject(request, project, subproject)

    obj.commit_pending(request)

    obj.locked = True
    obj.save()

    messages.info(
        request,
        _('Subproject is now locked for translation updates!')
    )

    return redirect(obj)
开发者ID:fluentglobe,项目名称:our,代码行数:14,代码来源:lock.py


示例19: show_subproject

def show_subproject(request, project, subproject):
    obj = get_subproject(request, project, subproject)

    last_changes = Change.objects.filter(
        translation__subproject=obj
    ).order_by('-timestamp')[:10]

    return render_to_response('subproject.html', RequestContext(request, {
        'object': obj,
        'last_changes': last_changes,
        'last_changes_rss': reverse(
            'rss-subproject',
            kwargs={'subproject': obj.slug, 'project': obj.project.slug}
        ),
    }))
开发者ID:msoftware,项目名称:weblate,代码行数:15,代码来源:basic.py


示例20: show_source

def show_source(request, project, subproject):
    '''
    Show source strings summary and checks.
    '''
    obj = get_subproject(request, project, subproject)
    if not obj.translation_set.exists():
        raise Http404('No translation exists in this subproject.')

    # Grab first translation in subproject
    # (this assumes all have same source strings)
    source = obj.translation_set.all()[0]

    return render_to_response('source.html', RequestContext(request, {
        'object': obj,
        'source': source,
        'title': _('Source strings in %s') % obj.__unicode__(),
    }))
开发者ID:thecantero,项目名称:weblate,代码行数:17,代码来源:basic.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python helper.get_translation函数代码示例发布时间:2022-05-27
下一篇:
Python helper.get_project函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap