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

Python utils.multi_to_dict函数代码示例

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

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



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


示例16: display

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

    datasets, reuses = multiquery(
        TopicSearchQuery(DatasetSearch, **kwargs),
        TopicSearchQuery(ReuseSearch, **kwargs),
    )

    return render('topic/display.html',
        topic=topic,
        datasets=datasets,
        reuses=reuses,
    )
开发者ID:rossjones,项目名称:udata,代码行数:14,代码来源:views.py


示例17: render_search

def render_search():
    params = multi_to_dict(request.args)
    params['facets'] = True
    datasets, organizations, reuses, users = search.multiquery(
        search.SearchQuery(Dataset, **params),
        search.SearchQuery(Organization, **params),
        search.SearchQuery(Reuse, **params),
        search.SearchQuery(User, **params),
    )
    return theme.render('search.html',
        datasets=datasets,
        organizations=organizations,
        reuses=reuses,
        users=users
    )
开发者ID:guillo-w,项目名称:udata,代码行数:15,代码来源:views.py


示例18: test_to_url_with_none

    def test_to_url_with_none(self):
        kwargs = {
            'q': 'test',
            'tag': ['tag1', 'tag2'],
            'page': 2,
        }
        search_query = search.SearchQuery(FakeSearch, **kwargs)
        with self.app.test_request_context('/an_url'):
            url = search_query.to_url(tag=None, other='value', replace=True)
        parsed_url = url_parse(url)
        qs = url_decode(parsed_url.query)

        self.assertEqual(parsed_url.path, '/an_url')
        self.assertEqual(multi_to_dict(qs), {
            'q': 'test',
            'other': 'value',
        })
开发者ID:pombredanne,项目名称:udata,代码行数:17,代码来源:test_search.py


示例19: test_to_url_with_specified_url

    def test_to_url_with_specified_url(self):
        kwargs = {
            'q': 'test',
            'tag': ['tag1', 'tag2'],
            'page': 2,
        }
        search_query = search.SearchQuery(FakeSearch, **kwargs)
        with self.app.test_request_context('/an_url'):
            url = search_query.to_url('/another_url')
        parsed_url = url_parse(url)
        qs = url_decode(parsed_url.query)

        self.assertEqual(parsed_url.path, '/another_url')
        self.assertEqual(multi_to_dict(qs), {
            'q': 'test',
            'tag': ['tag1', 'tag2'],
            'page': '2',
        })
开发者ID:pombredanne,项目名称:udata,代码行数:18,代码来源:test_search.py


示例20: test_to_url_with_specified_url

    def test_to_url_with_specified_url(self, app):
        kwargs = {
            'q': 'test',
            'tag': ['tag1', 'tag2'],
            'page': 2,
        }
        search_query = search.search_for(FakeSearch, **kwargs)
        with app.test_request_context('/an_url'):
            url = search_query.to_url('/another_url')
        parsed_url = url_parse(url)
        qs = url_decode(parsed_url.query)

        assert parsed_url.path == '/another_url'
        assert_json_equal(multi_to_dict(qs), {
            'q': 'test',
            'tag': ['tag1', 'tag2'],
            'page': '2',
        })
开发者ID:odtvince,项目名称:udata,代码行数:18,代码来源:test_query.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python faker.sentence函数代码示例发布时间:2022-05-27
下一篇:
Python utils.get_by函数代码示例发布时间: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