From 18d9e45562e138fd524a5f4848825e54751b3983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 13 Dec 2015 19:27:56 +0100 Subject: [PATCH] misc: make it possible to set default position in site-options (#9323) --- wcs/qommon/form.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wcs/qommon/form.py b/wcs/qommon/form.py index ebe16d9..6c5355a 100644 --- a/wcs/qommon/form.py +++ b/wcs/qommon/form.py @@ -2049,8 +2049,12 @@ class MapWidget(CompositeWidget): for attribute in ('initial_zoom', 'min_zoom', 'max_zoom'): if attribute in self.kwargs and self.kwargs.get(attribute) is not None: attrs['data-%s' % attribute] = self.kwargs.get(attribute) - if self.kwargs.get('default_position'): - attrs['data-def-lat'], attrs['data-def-lng'] = self.kwargs.get('default_position').split(';') + default_position = self.kwargs.get('default_position') + if not default_position: + default_position = get_publisher().get_site_option('default_position') + if not default_position: + default_position = '50.84;4.36' + attrs['data-def-lat'], attrs['data-def-lng'] = default_position.split(';') if self.kwargs.get('init_with_geoloc'): attrs['data-init-with-geoloc'] = 1 r += htmltext('
' % ' '.join(['%s="%s"' % x for x in attrs.items()])) -- 2.6.4