Author: jbronn
Date: 2009-03-19 21:10:47 -0500 (Thu, 19 Mar 2009)
New Revision: 10102

Modified:
   django/trunk/django/contrib/gis/maps/google/gmap.py
Log:
Fixed #10480 -- made `icons` a property to add more flexibility.


Modified: django/trunk/django/contrib/gis/maps/google/gmap.py
===================================================================
--- django/trunk/django/contrib/gis/maps/google/gmap.py 2009-03-20 01:43:35 UTC 
(rev 10101)
+++ django/trunk/django/contrib/gis/maps/google/gmap.py 2009-03-20 02:10:47 UTC 
(rev 10102)
@@ -71,9 +71,6 @@
                     else:
                         getattr(self, varname).append(overlay_class(overlay))
 
-        # Pulling any icons from the markers.
-        self.icons = [marker.icon for marker in self.markers if marker.icon]
-
         # If GMarker, GPolygons, and/or GPolylines are used the zoom will be
         # automatically calculated via the Google Maps API.  If both a zoom
         # level and a center coordinate are provided with polygons/polylines,
@@ -143,6 +140,11 @@
         "Returns XHTML information needed for IE VML overlays."
         return mark_safe('<html xmlns="http://www.w3.org/1999/xhtml"; %s>' % 
self.xmlns)
 
+    @property
+    def icons(self):
+        "Returns a sequence of GIcon objects in this map."
+        return [marker.icon for marker in self.markers if marker.icon]
+
 class GoogleMapSet(GoogleMap):
 
     def __init__(self, *args, **kwargs):
@@ -173,11 +175,6 @@
         else:
             self.maps = args
 
-        # Creating the icons sequence from every map in this set.
-        self.icons = []
-        for map in self.maps:
-            self.icons.extend(map.icons)
-
         # Generating DOM ids for each of the maps in the set.
         self.dom_ids = ['map%d' % i for i in xrange(len(self.maps))]
 
@@ -220,3 +217,10 @@
         # `google-multi.js`, which calls the load routines for
         # each one of the individual maps in the set.
         return mark_safe('onload="%s.load()"' % self.js_module)
+
+    @property
+    def icons(self):
+        "Returns a sequence of all icons in each map of the set."
+        icons = []
+        for map in self.maps: icons.extend(map.icons)
+        return icons


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to