Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1.     def _load_questions(self):
  2.         """
  3.        """
  4.         d = defer.Deferred()
  5.  
  6.         # simulate a delayed result by asking the reactor to fire the
  7.         # Deferred in 2 seconds time with the result x * 3
  8.         reactor.callLater(2, d.callback, 3)
  9.        
  10.         # is it the first time
  11.         if len(self.questions) == 0:
  12.             # load the questions from database
  13.             logging.info("Loading Trivia questions...")
  14.  
  15.             load startup questions
  16.             self.questions = self.service.getQuestions()
  17.  
  18.             # save the array in sharedobject (#46)
  19.             #self.setAttribute("askedQuestions", self.questions)
  20.        
  21.         log.msg('total questions: %s' % len(self.questions))
  22.  
  23.         return d
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement