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


Python utils.multi_to_dict函数代码示例

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


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

示例1: search

def search():
    datasets, organizations, reuses = multiquery(
        SearchQuery(DatasetSearch, **multi_to_dict(request.args)),
        SearchQuery(OrganizationSearch, **multi_to_dict(request.args)),
        SearchQuery(ReuseSearch, **multi_to_dict(request.args)),
    )
    return render("search.html", datasets=datasets, organizations=organizations, reuses=reuses)
开发者ID:rossjones,项目名称:udata,代码行数:7,代码来源:views.py

示例2: rdf_catalog_format

def rdf_catalog_format(format):
    params = multi_to_dict(request.args)
    page = int(params.get('page', 1))
    page_size = int(params.get('page_size', 100))
    datasets = Dataset.objects.visible().paginate(page, page_size)
    catalog = build_catalog(current_site, datasets, format=format)
    return graph_response(catalog, format)
开发者ID:odtvince,项目名称:udata,代码行数:7,代码来源:views.py

示例3: redirect_to_lang

def redirect_to_lang(*args, **kwargs):
    '''Redirect non lang-prefixed urls to default language.'''
    endpoint = request.endpoint.replace('_redirect', '')
    kwargs = multi_to_dict(request.args)
    kwargs.update(request.view_args)
    kwargs['lang_code'] = default_lang
    return redirect(url_for(endpoint, **kwargs))
开发者ID:michelbl,项目名称:udata,代码行数:7,代码来源:i18n.py

示例4: redirect_to_unlocalized

def redirect_to_unlocalized(*args, **kwargs):
    '''Redirect lang-prefixed urls to no prefixed URL.'''
    endpoint = request.endpoint.replace('_redirect', '')
    kwargs = multi_to_dict(request.args)
    kwargs.update(request.view_args)
    kwargs.pop('lang_code', None)
    return redirect(url_for(endpoint, **kwargs))
开发者ID:odtvince,项目名称:udata,代码行数:7,代码来源:i18n.py

示例5: get

 def get(self):
     """List all objects"""
     if self.search_adapter:
         objects = search.query(self.search_adapter, **multi_to_dict(request.args))
     else:
         objects = list(self.model.objects)
     return marshal_page(objects, self.fields)
开发者ID:noirbizarre,项目名称:udata,代码行数:7,代码来源:__init__.py

示例6: redirect_to_lang

def redirect_to_lang(*args, **kwargs):
    """Redirect non lang-prefixed urls to default language."""
    endpoint = request.endpoint.replace("_redirect", "")
    kwargs = multi_to_dict(request.args)
    kwargs.update(request.view_args)
    kwargs["lang_code"] = default_lang
    return redirect(url_for(endpoint, **kwargs))
开发者ID:ldolberg,项目名称:udata,代码行数:7,代码来源:i18n.py

示例7: render_search

def render_search():
    params = multi_to_dict(request.args)
    params['facets'] = True
    # We only fetch relevant data for the given filter.
    if 'tag' in params:
        search_queries = [
            search.SearchQuery(Dataset, **params),
            search.SearchQuery(Reuse, **params)
        ]
        results_labels = ['datasets', 'reuses']
    elif 'badge' in params:
        search_queries = [
            search.SearchQuery(Dataset, **params),
            search.SearchQuery(Organization, **params)
        ]
        results_labels = ['datasets', 'organizations']
    else:
        search_queries = [
            search.SearchQuery(Dataset, **params),
            search.SearchQuery(Reuse, **params),
            search.SearchQuery(Organization, **params),
            search.SearchQuery(User, **params)
        ]
        results_labels = ['datasets', 'reuses', 'organizations', 'users']
    results = search.multiquery(*search_queries)
    return theme.render('search.html',
                        **dict(zip(results_labels, results)))
开发者ID:ldolberg,项目名称:udata,代码行数:27,代码来源:views.py

示例8: get

 def get(self):
     if self.search_adapter:
         result = search.query(self.search_adapter, **multi_to_dict(request.args))
         objects = result.get_objects()
     else:
         objects = list(self.model.objects)
     return marshal(objects, self.fields)
开发者ID:rossjones,项目名称:udata,代码行数:7,代码来源:api.py

示例9: datasets

def datasets(topic):
    kwargs = multi_to_dict(request.args)
    kwargs.update(topic=topic)

    return theme.render('topic/datasets.html',
        topic=topic,
        datasets=TopicSearchQuery(Dataset, facets=True, **kwargs).execute()
    )
开发者ID:guillo-w,项目名称:udata,代码行数:8,代码来源:views.py

示例10: reuses

def reuses(topic):
    kwargs = multi_to_dict(request.args)
    kwargs.update(topic=topic)

    return theme.render('topic/reuses.html',
        topic=topic,
        reuses=TopicSearchQuery(Reuse, facets=True, **kwargs).execute()
    )
开发者ID:guillo-w,项目名称:udata,代码行数:8,代码来源:views.py

示例11: organizations_csv

def organizations_csv():
    params = multi_to_dict(request.args)
    # redirect to EXPORT_CSV dataset if feature is enabled and no filter is set
    exported_models = current_app.config.get('EXPORT_CSV_MODELS', [])
    if not params and 'organization' in exported_models:
        return redirect(get_export_url('organization'))
    params['facets'] = False
    organizations = search.iter(Organization, **params)
    return csv.stream(OrganizationCsvAdapter(organizations), 'organizations')
开发者ID:opendatateam,项目名称:udata,代码行数:9,代码来源:views.py

示例12: reuses_csv

def reuses_csv():
    params = multi_to_dict(request.args)
    # redirect to EXPORT_CSV dataset if feature is enabled and no filter is set
    exported_models = current_app.config.get('EXPORT_CSV_MODELS', [])
    if not params and 'reuse' in exported_models:
        return redirect(get_export_url('reuse'))
    params['facets'] = False
    reuses = search.iter(Reuse, **params)
    return csv.stream(ReuseCsvAdapter(reuses), 'reuses')
开发者ID:opendatateam,项目名称:udata,代码行数:9,代码来源:views.py

示例13: datasets_csv

def datasets_csv():
    params = multi_to_dict(request.args)
    # redirect to EXPORT_CSV dataset if feature is enabled and no filter is set
    exported_models = current_app.config.get('EXPORT_CSV_MODELS', [])
    if not params and 'dataset' in exported_models:
        return redirect(get_export_url('dataset'))
    params['facets'] = False
    datasets = search.iter(Dataset, **params)
    adapter = csv.get_adapter(Dataset)
    return csv.stream(adapter(datasets), 'datasets')
开发者ID:opendatateam,项目名称:udata,代码行数:10,代码来源:views.py

示例14: datasets

def datasets(topic):
    kwargs = multi_to_dict(request.args)
    kwargs.pop('topic', None)
    topic_search = topic_search_for(topic,
                                    DatasetSearch,
                                    facets=True,
                                    **kwargs)

    return theme.render(
        'topic/datasets.html',
        topic=topic,
        datasets=search.query(topic_search)
    )
开发者ID:odtvince,项目名称:udata,代码行数:13,代码来源:views.py

示例15: reuses

def reuses(topic):
    kwargs = multi_to_dict(request.args)
    kwargs.pop('topic', None)
    topic_search = topic_search_for(topic,
                                    ReuseSearch,
                                    facets=True,
                                    **kwargs)

    return theme.render(
        'topic/reuses.html',
        topic=topic,
        reuses=search.query(topic_search)
    )
开发者ID:odtvince,项目名称:udata,代码行数:13,代码来源:views.py


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