示例#1
0
文件: views.py 项目: Cybran111/Meowth
def contacts():
    page = Page.bl.get(Page.TYPE.CONTACTS)
    map_link = PageChunk.query.filter_by(name="map_url").one()
    parsed_map_url = contacts_map_coordinates.search(map_link.text)
    position_coords = {
        "lat": parsed_map_url.group("latitude"),
        "lon": parsed_map_url.group("longitude"),
        "zoom": parsed_map_url.group("zoom")
    }
    return render_template(
        'pages/contacts.html',
        blocks=page.blocks,
        map_coordinates=position_coords,
    )
示例#2
0
def contacts():
    page = Page.bl.get(Page.TYPE.CONTACTS)
    map_link = PageChunk.query.filter_by(name="map_url").one()
    parsed_map_url = contacts_map_coordinates.search(map_link.text)
    position_coords = {
        "lat": parsed_map_url.group("latitude"),
        "lon": parsed_map_url.group("longitude"),
        "zoom": parsed_map_url.group("zoom")
    }
    return render_template(
        'pages/contacts.html',
        blocks=page.blocks,
        map_coordinates=position_coords,
    )
示例#3
0
 def test_map_url_parses_gmaps(self):
     for regex, expected in map_url_links.items():
         actual = contacts_map_coordinates.search(regex)
         self.assertEqual(expected, actual.groups())