本文整理汇总了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