def CreateCallback(self): """Called when the entity is first saved.""" if len(self.key.id().split('/')) > 3: # Since this is not a test suite, the menu cache for the suite must # be updated. layered_cache.Delete(LIST_TESTS_SUBTEST_CACHE_KEY % self._GetMasterBotSuite(self.key))
def testDelete(self): self.SetCurrentUser('*****@*****.**') layered_cache.Set('hello', 'secret') self.SetCurrentUser('*****@*****.**') layered_cache.Set('hello', 'not secret') layered_cache.Delete('hello') self.SetCurrentUser('*****@*****.**') self.assertIsNone(layered_cache.Get('hello')) self.SetCurrentUser('*****@*****.**') self.assertIsNone(layered_cache.Get('hello'))
def post(self): """Handles a request to set the warning message.""" if self._ShowErrorIfNotLoggedIn(): return message = self.request.get('warning_message') if not message: layered_cache.Delete('warning_message') layered_cache.Delete('warning_bug') self.RenderHtml('result.html', {'headline': 'Warning message cleared.'}) else: results = [{'name': 'Warning message', 'value': message}] layered_cache.Set('warning_message', message, _DAYS_TO_SHOW_MESSAGE) bug = self.request.get('warning_bug') if bug: layered_cache.Set('warning_bug', bug, _DAYS_TO_SHOW_MESSAGE) results.append({'name': 'Bug ID', 'value': bug}) else: layered_cache.Delete('warning_bug') self.RenderHtml('result.html', { 'headline': 'Warning message set.', 'results': results })
def _MarkDeprecated(test): """Marks a Test as deprecated and yields Put operations.""" test.deprecated = True yield op.db.Put(test) # The sub-test listing function returns different results depending # on whether tests are deprecated, so when a new suite is deprecated, # the cache needs to be cleared. layered_cache.Delete(graph_data.LIST_TESTS_SUBTEST_CACHE_KEY % (test.master_name, test.bot_name, test.suite_name)) # Check whether the test suite now contains only deprecated tests, and # if so, deprecate it too. suite = ndb.Key(flat=test.key.flat()[:6]).get() if suite and not suite.deprecated and _AllSubtestsDeprecated(suite): suite.deprecated = True yield op.db.Put(suite)
def _pre_delete_hook(cls, key): if len(key.id().split('/')) > 3: # Since this is not a test suite, the menu cache for the suite must # be updated. layered_cache.Delete(LIST_TESTS_SUBTEST_CACHE_KEY % TestMetadata._GetMasterBotSuite(key))
def _pre_delete_hook(cls, key): if key.parent() and key.parent().kind() != 'Bot': layered_cache.Delete(LIST_TESTS_SUBTEST_CACHE_KEY % Test._GetMasterBotSuite(key))
def CreateCallback(self): """Called when the entity is first saved.""" if self.key.parent().kind() != 'Bot': layered_cache.Delete(LIST_TESTS_SUBTEST_CACHE_KEY % self._GetMasterBotSuite(self.key))