本文整理汇总了Python中common.utils.Basic.validate_result方法的典型用法代码示例。如果您正苦于以下问题:Python Basic.validate_result方法的具体用法?Python Basic.validate_result怎么用?Python Basic.validate_result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.utils.Basic
的用法示例。
在下文中一共展示了Basic.validate_result方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _on_bank_stopped
# 需要导入模块: from common.utils import Basic [as 别名]
# 或者: from common.utils.Basic import validate_result [as 别名]
def _on_bank_stopped(self, result):
Basic.validate_result(result, "bank_stopped")
#now stop tor:
log_msg("Waiting for Tor to shut down...", 3)
d = None
if self.torApp:
d = self.torApp.stop()
if not d:
d = self._on_tor_stopped(True)
else:
d.addCallback(self._on_tor_stopped)
d.addErrback(self._on_tor_stopped)
return d
示例2: _on_applications_stopped
# 需要导入模块: from common.utils import Basic [as 别名]
# 或者: from common.utils.Basic import validate_result [as 别名]
def _on_applications_stopped(self, result):
Basic.validate_result(result, "applications_stopped")
self.isReady = False
HTTPClient.stop_all()
#now stop the bank:
log_msg("Waiting for the bank to shut down...", 3)
d = None
if self.bankApp:
d = self.bankApp.stop()
if not d:
d = self._on_bank_stopped(True)
else:
d.addCallback(self._on_bank_stopped)
d.addErrback(self._on_bank_stopped)
return d
示例3: _startup_success
# 需要导入模块: from common.utils import Basic [as 别名]
# 或者: from common.utils.Basic import validate_result [as 别名]
def _startup_success(self, result):
self.startupDeferred = None
self.isReady = True
result = Basic.validate_result(result, "BitBlinder startup")
if not result:
self.stop()
self._trigger_event("started")
return result
示例4: _shutdown
# 需要导入模块: from common.utils import Basic [as 别名]
# 或者: from common.utils.Basic import validate_result [as 别名]
def _shutdown(self, result):
"""Stop the main loop and cause the program to exit.
This should ONLY be called after all Applications are shut down cleanly."""
Basic.validate_result(result, "MainLoop::_shutdown")
#close the server that listens for new versions of the app to start up:
StartupServer.stop()
#remove scheduled events:
if self.updateEvent and self.updateEvent.active():
self.updateEvent.cancel()
ProgramState.DO_UPDATES = False
self.updateEvent = None
GlobalEvents.throw_event("shutdown")
log_msg("Done with shutdown deferreds", 4)
#close the main loop
if ProgramState.USE_GTK:
try:
gtk.main_quit()
except Exception, error:
log_ex(error, "Couldn't kill the gtk main loop")
示例5: _stop_done
# 需要导入模块: from common.utils import Basic [as 别名]
# 或者: from common.utils.Basic import validate_result [as 别名]
def _stop_done(self, result):
Basic.validate_result(result, "BitTorrentWindow::_stop_done")
if not BitBlinder.get().is_running():
GlobalEvents.throw_event("quit_signal")
else:
#are there any other apps using bitblinder?
for app in BitBlinder.get().applications.values():
#if there is another app, dont bother shutting down everything
if app.is_running() and app != Bank.get():
return
#ok, check if there is a relay then
if Tor.get().settings.beRelay:
#then we should prompt about shutdown
def callback(dialog, response):
if response == gtk.RESPONSE_YES:
self._do_quit()
msgText = "BitBlinder is acting as a server and help others be anonymous, and earning you more credits!\n\nDo you also want to stop the server?"
GUIController.get().show_preference_prompt(msgText, "Stop Relay?", callback, "promptAboutRelayQuit")
else:
#otherwise shutdown completely:
self._do_quit()
示例6: _stop_when_started
# 需要导入模块: from common.utils import Basic [as 别名]
# 或者: from common.utils.Basic import validate_result [as 别名]
def _stop_when_started(self, result, cancelDeferred):
Basic.validate_result(result, "_stop_when_started")
self.stop().chainDeferred(cancelDeferred)
示例7: _quit_done
# 需要导入模块: from common.utils import Basic [as 别名]
# 或者: from common.utils.Basic import validate_result [as 别名]
def _quit_done(self, result):
Basic.validate_result(result, "BitTorrentWindow::_quit_done")
GlobalEvents.throw_event("quit_signal")
示例8: _on_tor_stopped
# 需要导入模块: from common.utils import Basic [as 别名]
# 或者: from common.utils.Basic import validate_result [as 别名]
def _on_tor_stopped(self, result):
Basic.validate_result(result, "tor_stopped")
log_msg("BitBlinder finished.", 3)
#finally done shutting down
return defer.succeed(True)