def postApplication(self): """ THis code is taken directly from UnixApplicationRunner """ log.debug("[D] %s %s " % (__file__, __name__), "Class GLBaseRunnerUnix", "postApplication") def runApp(res): """ Start the actual service Application. """ log.debug("[D] %s %s " % (__file__, __name__), "Class GLBaseRunnerUnix", "postApplication", "runApp") print "Running start." self.startApplication(self.application) startAsynchronous() print "GLBackend is now running" print "Visit http://127.0.0.1:8082/index.html to interact with me" d = createTables() d.addBoth(runApp) self.startReactor(None, self.oldstdout, self.oldstderr) self.removePID(self.config['pidfile'])
def test_add_tip(self): from datetime import datetime yield createTables() tip = InternalTip() tip.fields = {'hello': 'world'} tip.comments = {'hello': 'world'} tip.pertinence = 0 expiration_time = datetime.now() tip.expiration_time = expiration_time yield tip.save() def findtip(what): store = getStore() x = list(store.find(InternalTip, InternalTip.id == what)) return x r_tip = yield transactor.run(findtip, tip.id) self.assertEqual(r_tip[0].fields['hello'], 'world') self.assertEqual(r_tip[0].comments['hello'], 'world') print "I am here now!" threadpool.stop()
def postApplication(self): """ This code is taken directly from the method postApplication of WindowsApplicationRunner. """ log.debug("[D] %s %s " % (__file__, __name__), "Class GLBaseRunnerWindows", "postApplication") def runApp(res): """ Start the actual service Application. """ log.debug("[D] %s %s " % (__file__, __name__), "Class GLBaseRunner", "preApplication", "runApp") service.IService(self.application).privilegedStartService() app.startApplication(self.application, not self.config['no_save']) app.startApplication(internet.TimerService(0.1, lambda:None), 0) startAsynchronous() print "WARNING! Windows is not tested!" d = createTables() d.addCallback(runApp) self.startReactor(None, self.oldstdout, self.oldstderr) log.msg("Server Shut Down.")
def initializeDB(): print "[+] Creating dummy tables..." yield createTables()