def module_run(self):
sources = self.query('SELECT COUNT(source), source FROM pushpins GROUP BY source')
media_content, map_content = self.build_content(sources)
meta_content = (self.options['latitude'], self.options['longitude'], self.options['radius'])
# create the media report
media_content = meta_content + media_content
media_filename = self.options['media_filename']
self.write_markup(os.path.join(self.data_path, 'template_media.html'), media_filename, media_content)
self.output('Media data written to \'%s\'' % (media_filename))
# order the map_content tuple
map_content = meta_content + map_content
order=[4,0,1,2,3,5]
map_content = tuple([map_content[i] for i in order])
# create the map report
map_filename = self.options['map_filename']
self.write_markup(os.path.join(self.data_path, 'template_map.html'), map_filename, map_content)
self.output('Mapping data written to \'%s\'' % (map_filename))
# open the reports in a browser
w = webbrowser.get()
w.open(media_filename)
time.sleep(2)
w.open(map_filename)
评论列表
文章目录