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, )
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())