~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/browser/__init__.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2010-08-28 23:35:29 UTC
  • mfrom: (11462.1.4 disable-gmaps-0)
  • Revision ID: launchpad@pqm.canonical.com-20100828233529-7l4saytfk906c1vm
[r=lifeless][ui=none][bug 624981] Add a rudimentary feature flag to
        disable Google maps.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 
8
8
__all__ = [
9
9
    'get_status_counts',
 
10
    'MapMixin',
10
11
    'MilestoneOverlayMixin',
11
12
    'RegistryEditFormView',
12
13
    'RegistryDeleteViewMixin',
19
20
from storm.store import Store
20
21
from zope.component import getUtility
21
22
 
 
23
from canonical.cachedproperty import cachedproperty
22
24
from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
23
25
from canonical.launchpad.webapp.launchpadform import (
24
26
    action,
256
258
    @action("Change", name='change')
257
259
    def change_action(self, action, data):
258
260
        self.updateContextFromData(data)
 
261
 
 
262
 
 
263
class MapMixin:
 
264
 
 
265
    @cachedproperty
 
266
    def gmap2_enabled(self):
 
267
        # XXX sinzui 2010-08-27 bug=625556: This is a hack to use
 
268
        # feature flags, which are not ready for general use in the production
 
269
        # code, but has just enough to support this use case:
 
270
        # Do not enable gmap2 if Google's service is not operational.
 
271
        from lp.services.features.flags import FeatureController
 
272
 
 
273
        def in_scope(value):
 
274
            return True
 
275
 
 
276
        return FeatureController(in_scope).getFlag('gmap2') == 'on'