当前位置: 首页>>代码示例>>Python>>正文


Python error.ConnectionError方法代码示例

本文整理汇总了Python中twisted.internet.error.ConnectionError方法的典型用法代码示例。如果您正苦于以下问题:Python error.ConnectionError方法的具体用法?Python error.ConnectionError怎么用?Python error.ConnectionError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.internet.error的用法示例。


在下文中一共展示了error.ConnectionError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: logOn

# 需要导入模块: from twisted.internet import error [as 别名]
# 或者: from twisted.internet.error import ConnectionError [as 别名]
def logOn(self, chatui):
        """
        @returns: this breaks with L{interfaces.IAccount}
        @returntype: DeferredList of L{interfaces.IClient}s
        """
        # Overriding basesupport's implementation on account of the
        # fact that _startLogOn tends to return a deferredList rather
        # than a simple Deferred, and we need to do registerAccountClient.
        if (not self._isConnecting) and (not self._isOnline):
            self._isConnecting = 1
            d = self._startLogOn(chatui)
            d.addErrback(self._loginFailed)
            def registerMany(results):
                for success, result in results:
                    if success:
                        chatui.registerAccountClient(result)
                        self._cb_logOn(result)
                    else:
                        log.err(result)
            d.addCallback(registerMany)
            return d
        else:
            raise error.ConnectionError("Connection in progress") 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:25,代码来源:pbsupport.py

示例2: logOn

# 需要导入模块: from twisted.internet import error [as 别名]
# 或者: from twisted.internet.error import ConnectionError [as 别名]
def logOn(self, chatui):
        """Log on to this account.

        Takes care to not start a connection if a connection is
        already in progress.  You will need to implement
        L{_startLogOn} for this to work, and it would be a good idea
        to override L{_loginFailed} too.

        @returntype: Deferred L{interfaces.IClient}
        """
        if (not self._isConnecting) and (not self._isOnline):
            self._isConnecting = 1
            d = self._startLogOn(chatui)
            d.addErrback(self._loginFailed)
            d.addCallback(self._cb_logOn)
            # if chatui is not None:
            # (I don't particularly like having to pass chatUI to this function,
            # but we haven't factored it out yet.)
            d.addCallback(chatui.registerAccountClient)
            return d
        else:
            raise error.ConnectionError("Connection in progress") 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:24,代码来源:basesupport.py


注:本文中的twisted.internet.error.ConnectionError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。