equal
deleted
inserted
replaced
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
7 """ |
7 """ |
8 __docformat__ = "restructuredtext en" |
8 __docformat__ = "restructuredtext en" |
9 |
9 |
10 import simplejson |
10 try: |
|
11 import json |
|
12 except ImportError: |
|
13 import simplejson as json |
11 |
14 |
12 from cubicweb.interfaces import IGeocodable |
15 from cubicweb.interfaces import IGeocodable |
13 from cubicweb.view import EntityView |
16 from cubicweb.view import EntityView |
14 from cubicweb.selectors import implements |
17 from cubicweb.selectors import implements |
15 |
18 |
37 geodata = { |
40 geodata = { |
38 'zoomlevel': int(zoomlevel), |
41 'zoomlevel': int(zoomlevel), |
39 'center': center, |
42 'center': center, |
40 'markers': markers, |
43 'markers': markers, |
41 } |
44 } |
42 self.w(simplejson.dumps(geodata)) |
45 self.w(json.dumps(geodata)) |
43 |
46 |
44 def build_marker_data(self, row, extraparams): |
47 def build_marker_data(self, row, extraparams): |
45 entity = self.cw_rset.get_entity(row, 0) |
48 entity = self.cw_rset.get_entity(row, 0) |
46 icon = None |
49 icon = None |
47 if hasattr(entity, 'marker_icon'): |
50 if hasattr(entity, 'marker_icon'): |