コード例 #1
0
ファイル: utils.py プロジェクト: zhang-pc/chromium-net
def GetIpWhitelist():
  """Returns a list of IP address strings in the whitelist."""
  return stored_object.Get(IP_WHITELIST_KEY)
コード例 #2
0
ファイル: bisect_fyi.py プロジェクト: stevenjb/catapult
def _GetBisectConfig(job):
  bisect_fyi_configs = stored_object.Get(_BISECT_FYI_CONFIGS_KEY)
  for test_name, config in bisect_fyi_configs.iteritems():
    if job.job_name == test_name:
      return config
  return {}
コード例 #3
0
def IsInternalUser():
    """Checks whether the user should be able to see internal-only data."""
    user = users.get_current_user()
    domain = stored_object.Get(INTERNAL_DOMAIN_KEY)
    return user and domain and user.email().endswith('@' + domain)
コード例 #4
0
def IsValidSheriffUser():
    """Checks whether the user should be allowed to triage alerts."""
    user = users.get_current_user()
    sheriff_domains = stored_object.Get(SHERIFF_DOMAINS_KEY)
    return user and sheriff_domains and any(user.email().endswith('@' + domain)
                                            for domain in sheriff_domains)
コード例 #5
0
def FetchCachedTestSuites():
    """Fetches cached test suite data."""
    return stored_object.Get(_NamespaceKey(_LIST_SUITES_CACHE_KEY))
コード例 #6
0
 def testDelete_BothVersionsDeleted(self):
     stored_object.Set('internal_only__foo', [1, 2, 3])
     stored_object.Set('externally_visible__foo', [4, 5, 6])
     namespaced_stored_object.Delete('foo')
     self.assertIsNone(stored_object.Get('internal_only__foo'))
     self.assertIsNone(stored_object.Get('externally_visible__foo'))
コード例 #7
0
 def testSetExternal_InternalUser_ExternalVersionSet(self):
     self.SetCurrentUser('*****@*****.**')
     namespaced_stored_object.SetExternal('foo', 12345)
     self.assertIsNone(stored_object.Get('internal_only__foo'))
     self.assertEqual(12345, stored_object.Get('externally_visible__foo'))
コード例 #8
0
def Get(key):
    """Gets either the external or internal copy of an object."""
    namespaced_key = _NamespaceKey(key)
    return stored_object.Get(namespaced_key)
コード例 #9
0
def GetExternal(key):
    """Gets the external copy of a stored object."""
    namespaced_key = _NamespaceKey(key, datastore_hooks.EXTERNAL)
    return stored_object.Get(namespaced_key)