view.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:osm-wikidata 作者: EdwardBetts 项目源码 文件源码
def add_tags(osm_type, osm_id):
    place = Place.get_or_abort(osm_type, osm_id)

    include = request.form.getlist('include')
    items = Item.query.filter(Item.item_id.in_([i[1:] for i in include])).all()

    table = [(item, match['candidate'])
             for item, match in matcher.filter_candidates_more(items, bad=get_bad(items))
             if 'candidate' in match]

    items = [{'row_id': '{:s}-{:s}-{:d}'.format(i.qid, c.osm_type, c.osm_id),
              'qid': i.qid,
              'osm_type': c.osm_type,
              'osm_id': c.osm_id,
              'description': '{} {}: adding wikidata={}'.format(c.osm_type, c.osm_id, i.qid),
              'post_tag_url': url_for('.post_tag',
                                      item_id=i.item_id,
                                      osm_id=c.osm_id,
                                      osm_type=c.osm_type)} for i, c in table]

    if False and request.form.get('confirm') == 'yes':
        update_count = do_add_tags(place, table)
        flash('{:,d} wikidata tags added to OpenStreetMap'.format(update_count))
        return redirect(place.candidates_url())

    return render_template('add_tags.html',
                           place=place,
                           osm_id=osm_id,
                           items=items,
                           table=table)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号