~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/services/features/flags.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-12-14 18:16:47 UTC
  • mfrom: (14515 devel)
  • mto: This revision was merged to the branch mainline in revision 14593.
  • Revision ID: launchpad@pqm.canonical.com-20111214181647-jh80eps1ndcy6hns
[rs=buildbot-poller] automatic merge from stable. Revisions: 14510,
        14511, 14512, 14513, 14514, 14515 included.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
    ]
11
11
 
12
12
 
 
13
import logging
 
14
 
13
15
from lp.services.features.rulesource import (
14
16
    NullFeatureRuleSource,
15
17
    StormFeatureRuleSource,
19
21
__metaclass__ = type
20
22
 
21
23
 
 
24
logger = logging.getLogger('lp.services.features')
 
25
 
22
26
value_domain_info = sorted([
23
27
    ('boolean',
24
28
     'Any non-empty value is true; an empty value is false.'),
356
360
        if flag in self._rules:
357
361
            for scope, priority, value in self._rules[flag]:
358
362
                if self._known_scopes.lookup(scope):
 
363
                    self._debugMessage(
 
364
                        'feature match flag=%r value=%r scope=%r' %
 
365
                        (flag, value, scope))
359
366
                    return (value, scope)
 
367
            else:
 
368
                self._debugMessage('no rules matched for %r' % flag)
 
369
        else:
 
370
            self._debugMessage('no rules relevant to %r' % flag)
360
371
        return (None, None)
361
372
 
 
373
    def _debugMessage(self, message):
 
374
        logger.debug(message)
 
375
        # The OOPS machinery can also grab it out of the request if needed.
 
376
 
362
377
    def currentScope(self, flag):
363
378
        """The name of the scope of the matching rule with the highest
364
379
        priority.