Skip to content

Commit a4a24cc

Browse files
committed
Consistent use of the kw attr
1 parent 06df1a2 commit a4a24cc

3 files changed

Lines changed: 7 additions & 10 deletions

File tree

folium/features.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class WmsTileLayer(TileLayer):
1919
def __init__(self, url, name=None,
2020
format=None, layers=None, transparent=True,
21-
attribution=None):
21+
attr=None):
2222
"""
2323
TODO docstring here
2424
@@ -30,10 +30,7 @@ def __init__(self, url, name=None,
3030
self.format = format
3131
self.layers = layers
3232
self.transparent = transparent
33-
# if attribution is None:
34-
# raise ValueError('WMS must'
35-
# ' also be passed an attribution')
36-
self.attribution = attribution
33+
self.attr = attr
3734

3835
self._template = Template(u"""
3936
{% macro script(this, kwargs) %}
@@ -43,7 +40,7 @@ def __init__(self, url, name=None,
4340
format:'{{ this.format }}',
4441
transparent: {{ this.transparent.__str__().lower() }},
4542
layers:'{{ this.layers }}'
46-
{% if this.attribution %}, attribution:'{{this.attribution}}'{% endif %}
43+
{% if this.attr %}, attribution:'{{this.attr}}'{% endif %}
4744
}
4845
).addTo({{this._parent.get_name()}});
4946
@@ -619,7 +616,7 @@ def __init__(self, locations, color=None, weight=None,
619616

620617

621618
class ImageOverlay(MacroElement):
622-
def __init__(self, image, bounds, opacity=1., attribution=None,
619+
def __init__(self, image, bounds, opacity=1., attr=None,
623620
origin='upper', colormap=None, mercator_project=False):
624621
"""
625622
Used to load and display a single image over specific bounds of
@@ -664,7 +661,7 @@ def __init__(self, image, bounds, opacity=1., attribution=None,
664661
self.bounds = json.loads(json.dumps(bounds))
665662
options = {
666663
'opacity': opacity,
667-
'attribution': attribution,
664+
'attribution': attr,
668665
}
669666
self.options = json.dumps({key: val for key, val
670667
in options.items() if val},

folium/folium.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def add_wms_layer(self, wms_name=None, wms_url=None, wms_format=None,
6868
FutureWarning, stacklevel=2)
6969
wms = WmsTileLayer(wms_url, name=wms_name, format=wms_format,
7070
layers=wms_layers, transparent=wms_transparent,
71-
attribution=None)
71+
attr=None)
7272
self.add_children(wms, name=wms_name)
7373

7474
def simple_marker(self, location=None, popup=None,

tests/test_features.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def test_wms_service():
9999
name='test',
100100
format='image/png',
101101
layers='nexrad-n0r-900913',
102-
attribution=u"Weather data © 2012 IEM Nexrad",
102+
attr=u"Weather data © 2012 IEM Nexrad",
103103
transparent=True)
104104
w.add_to(m)
105105
m._repr_html_()

0 commit comments

Comments
 (0)