本文整理匯總了Python中stoqlib.lib.webservice.WebService.link_registration方法的典型用法代碼示例。如果您正苦於以下問題:Python WebService.link_registration方法的具體用法?Python WebService.link_registration怎麽用?Python WebService.link_registration使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類stoqlib.lib.webservice.WebService
的用法示例。
在下文中一共展示了WebService.link_registration方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: next_step
# 需要導入模塊: from stoqlib.lib.webservice import WebService [as 別名]
# 或者: from stoqlib.lib.webservice.WebService import link_registration [as 別名]
def next_step(self):
# We already sent the details, but may still be on the same step.
# Also, if the user didn't choose to "register now", respect his
# decision
if not self.model.register_now or self.wizard.link_request_done:
return FinishInstallationStep(self.wizard)
webapi = WebService()
response = webapi.link_registration(
self.model.name, self.model.email, self.model.phone)
response.addCallback(self._on_response_done)
response.addErrback(self._on_response_error)
# FIXME: This is a hack, remove it when we can avoid
# calling dialog.run()
if not reactor.running:
reactor.run()
self.send_progress.show()
self.send_progress.set_text(_('Sending...'))
self.send_progress.set_pulse_step(0.05)
self.wizard.next_button.set_sensitive(False)
glib.timeout_add(50, self._pulse)
# Cancel the request after 30 seconds without a reply
glib.timeout_add(30000, self._cancel_request)
# Stay on the same step while sending the details
return self
示例2: next_step
# 需要導入模塊: from stoqlib.lib.webservice import WebService [as 別名]
# 或者: from stoqlib.lib.webservice.WebService import link_registration [as 別名]
def next_step(self):
# We already sent the details, but may still be on the same step.
# Also, if the user didn't choose to "register now", respect his
# decision
if not self.model.register_now or self.wizard.link_request_done:
return FinishInstallationStep(self.wizard)
webapi = WebService()
webapi.link_registration(
self.model.name, self.model.email, self.model.phone,
callback=lambda r: schedule_in_main_thread(self._on_response_done, r),
errback=lambda e: schedule_in_main_thread(self._on_response_error, e))
self.send_progress.show()
self.send_progress.set_text(_('Sending...'))
self.send_progress.set_pulse_step(0.05)
self.wizard.next_button.set_sensitive(False)
GLib.timeout_add(50, self._pulse)
# Cancel the request after 30 seconds without a reply
GLib.timeout_add(30000, self._cancel_request)
# Stay on the same step while sending the details
return self