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


Python VirtualFolder.get_matching_for方法代码示例

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


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

示例1: make_directory_item

# 需要导入模块: from virtualfolder.models import VirtualFolder [as 别名]
# 或者: from virtualfolder.models.VirtualFolder import get_matching_for [as 别名]
def make_directory_item(directory):
    filters = {}

    if VirtualFolder.get_matching_for(directory.pootle_path).count():
        # The directory has virtual folders, so append priority sorting to URL.
        filters['sort'] = 'priority'

    item = make_generic_item(directory, **filters)
    item.update({
        'icon': 'folder',
    })
    return item
开发者ID:actsgo,项目名称:pootle,代码行数:14,代码来源:browser.py

示例2: get_vfolders

# 需要导入模块: from virtualfolder.models import VirtualFolder [as 别名]
# 或者: from virtualfolder.models.VirtualFolder import get_matching_for [as 别名]
def get_vfolders(directory, all_vfolders=False):
    """Return a list of virtual folders for this ``directory``.

    The elements of the list are dictionaries which keys are populated after
    in the templates.

    If ``all_vfolders`` is True then all the virtual folders matching the
    provided directory are returned. If not only the visible ones are returned.
    """
    if all_vfolders:
        return [make_vfolder_item(vf, directory.pootle_path)
            for vf in VirtualFolder.get_matching_for(directory.pootle_path)]

    return [make_vfolder_item(vf, directory.pootle_path)
            for vf in VirtualFolder.get_visible_for(directory.pootle_path)]
开发者ID:Robens,项目名称:pootle,代码行数:17,代码来源:browser.py

示例3: get_browser_context

# 需要导入模块: from virtualfolder.models import VirtualFolder [as 别名]
# 或者: from virtualfolder.models.VirtualFolder import get_matching_for [as 别名]
def get_browser_context(request):
    """Returns a common context for browser pages.

    :param request: a :cls:`django.http.HttpRequest` object.
    """
    resource_obj = request.resource_obj
    resource_path = getattr(request, 'resource_path', '')

    filters = {}

    if (not isinstance(resource_obj, Store) and
        VirtualFolder.get_matching_for(request.pootle_path).count()):
        filters['sort'] = 'priority'

    url_action_continue = resource_obj.get_translate_url(state='incomplete',
                                                         **filters)
    url_action_fixcritical = resource_obj.get_critical_url(**filters)
    url_action_review = resource_obj.get_translate_url(state='suggestions',
                                                       **filters)
    url_action_view_all = resource_obj.get_translate_url(state='all')

    return {
        'page': 'browse',

        'pootle_path': request.pootle_path,
        'resource_obj': resource_obj,
        'resource_path': resource_path,
        'resource_path_parts': get_path_parts(resource_path),

        'translation_states': get_translation_states(resource_obj),
        'check_categories': get_qualitycheck_schema(resource_obj),

        'url_action_continue': url_action_continue,
        'url_action_fixcritical': url_action_fixcritical,
        'url_action_review': url_action_review,
        'url_action_view_all': url_action_view_all,
    }
开发者ID:cedk,项目名称:pootle,代码行数:39,代码来源:helpers.py


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