Skip to content

Commit 6185ae2

Browse files
committed
Merge pull request #27 from tbicr/template-structure
Extract tile templates
2 parents 80ac1fb + 3d0536d commit 6185ae2

File tree

19 files changed

+6
-4
lines changed

19 files changed

+6
-4
lines changed

folium/folium.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import codecs
1414
import json
1515
import functools
16+
import os
1617
from jinja2 import Environment, PackageLoader
1718
from pkg_resources import resource_string, resource_filename
1819
from uuid import uuid4
@@ -153,10 +154,11 @@ def __init__(self, location=None, width=960, height=500,
153154
'stamenterrain', 'stamentoner']
154155
self.tile_types = {}
155156
for tile in self.default_tiles:
156-
self.tile_types[tile] = {'templ':
157-
self.env.get_template(tile + '_tiles.txt'),
158-
'attr':
159-
self.env.get_template(tile + '_att.txt')}
157+
join_tile_path = functools.partial(os.path.join, 'tiles', tile)
158+
self.tile_types[tile] = {
159+
'templ': self.env.get_template(join_tile_path('tiles.txt')),
160+
'attr': self.env.get_template(join_tile_path('attr.txt')),
161+
}
160162

161163
if self.tiles in self.tile_types:
162164
self.template_vars['Tiles'] = (self.tile_types[self.tiles]['templ']

0 commit comments

Comments
 (0)