Skip to content

Commit

Permalink
Better infomap 'force one layer'.
Browse files Browse the repository at this point in the history
  • Loading branch information
philipn committed Nov 27, 2011
1 parent 62ec454 commit a4ba571
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 4 additions & 5 deletions sapling/maps/widgets.py
Expand Up @@ -2,8 +2,6 @@
# This is a thin wrapper over olwidget.
# We provide our own media.
################################################
from urlparse import urljoin

from django.conf import settings

from olwidget import widgets
Expand All @@ -27,8 +25,9 @@ class InfoMap(MediaMixin, widgets.InfoMap):

def __init__(self, *args, **kwargs):
val = super(InfoMap, self).__init__(*args, **kwargs)
# Just display one layer for InfoMaps, for now.
if len(self.options['layers']) > 1:
self.options['layers'] = self.options['layers'][:1]
# Potentially limit # of layers on InfoMaps, for now. This helps
# with quicker load times on most pages.
max_layers = getattr(settings, 'OLWIDGET_INFOMAP_MAX_LAYERS', 1)
self.options['layers'] = self.options['layers'][:max_layers]
return val

4 changes: 4 additions & 0 deletions sapling/settings.py
Expand Up @@ -126,6 +126,10 @@
# django-guardian setting
ANONYMOUS_USER_ID = -1

# By default we load only one map layer on most pages to speed up load
# times.
OLWIDGET_INFOMAP_MAX_LAYERS = 1

# Should we display user's IP addresses to non-admin users?
SHOW_IP_ADDRESSES = True

Expand Down

0 comments on commit a4ba571

Please sign in to comment.