本文整理汇总了Python中twisted.python.components.backwardsCompatImplements函数的典型用法代码示例。如果您正苦于以下问题:Python backwardsCompatImplements函数的具体用法?Python backwardsCompatImplements怎么用?Python backwardsCompatImplements使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了backwardsCompatImplements函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _startTLS
def _startTLS(self):
self.TLS = 1
klass = self.__class__
class TLSConnection(_TLSMixin, klass):
implements(interfaces.ISSLTransport)
components.backwardsCompatImplements(TLSConnection)
self.__class__ = TLSConnection
开发者ID:pwarren,项目名称:AGDeviceControl,代码行数:7,代码来源:tcp.py
示例2: testClassIsGCd
def testClassIsGCd(self):
import weakref, gc
class Test(object):
zinterface.implements(IZope)
# Do some stuff with it
components.backwardsCompatImplements(Test)
IZope(Test())
# Make a weakref to it, then ensure the weakref goes away
r = weakref.ref(Test)
del Test
gc.collect()
self.assertEquals(r(), None)
开发者ID:galaxysd,项目名称:BitTorrent,代码行数:13,代码来源:test_components.py
示例3: render
will be the rendered page, unless the return value is
twisted.web.server.NOT_DONE_YET, in which case it is this
class's responsibility to write the results to
request.write(data), then call request.finish().
Old code that overrides render() directly is likewise expected
to return a string or NOT_DONE_YET.
"""
m = getattr(self, 'render_' + request.method, None)
if not m:
from twisted.web.server import UnsupportedMethod
raise UnsupportedMethod(getattr(self, 'allowedMethods', ()))
return m(request)
def render_HEAD(self, request):
"""Default handling of HEAD method.
I just return self.render_GET(request). When method is HEAD,
the framework will handle this correctly.
"""
return self.render_GET(request)
components.backwardsCompatImplements(Resource)
#t.w imports
#This is ugly, I know, but since error.py directly access resource.Resource
#during import-time (it subclasses it), the Resource class must be defined
#by the time error is imported.
import error
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:30,代码来源:resource.py
示例4: getHost
def getHost(self):
"""Returns the address from which I am connecting."""
h, p = self.socket.getsockname()
return address.IPv4Address("TCP", h, p, "SSL")
def getPeer(self):
"""Returns the address that I am connected."""
return address.IPv4Address("TCP", self.addr[0], self.addr[1], "SSL")
def _connectDone(self):
self.startTLS(self.ctxFactory)
self.startWriting()
tcp.Client._connectDone(self)
components.backwardsCompatImplements(Client)
class Server(tcp.Server):
"""I am an SSL server.
"""
implements(interfaces.ISSLTransport)
def getHost(self):
"""Return server's address."""
h, p = self.socket.getsockname()
return address.IPv4Address("TCP", h, p, "SSL")
def getPeer(self):
"""Return address of peer."""
开发者ID:RichDijk,项目名称:eXe,代码行数:31,代码来源:ssl.py
示例5: _EverythingEphemeral
"""
ext, dumpFunc = self._getStyle()
if passphrase:
ext = "e" + ext
finalname, filename = self._getFilename(filename, ext, tag)
log.msg("Saving " + self.name + " application to " + finalname + "...")
self._saveTemp(filename, passphrase, dumpFunc)
if runtime.platformType == "win32" and os.path.isfile(finalname):
os.remove(finalname)
os.rename(filename, finalname)
log.msg("Saved.")
# "Persistant" has been present since 1.0.7, so retain it for compatibility
Persistant = Persistent
components.backwardsCompatImplements(Persistent)
class _EverythingEphemeral(styles.Ephemeral):
initRun = 0
def __getattr__(self, key):
try:
return getattr(mainMod, key)
except AttributeError:
if self.initRun:
raise
else:
log.msg("Warning! Loading from __main__: %s" % key)
return styles.Ephemeral()
开发者ID:pwarren,项目名称:AGDeviceControl,代码行数:31,代码来源:sob.py
示例6: removeAll
def removeAll(self):
return self._removeAll(reads, writes)
where reads, writes are iterables.
"""
readers = [reader for reader in readers if
reader is not self.waker]
readers_dict = {}
for reader in readers:
readers_dict[reader] = 1
for reader in readers:
self.removeReader(reader)
self.removeWriter(reader)
writers = [writer for writer in writers if
writer not in readers_dict]
for writer in writers:
self.removeWriter(writer)
return readers+writers
if sslEnabled:
classImplements(PosixReactorBase, IReactorSSL)
if unixEnabled:
classImplements(PosixReactorBase, IReactorUNIX, IReactorUNIXDatagram, IReactorProcess)
components.backwardsCompatImplements(PosixReactorBase)
__all__ = ["PosixReactorBase"]
开发者ID:pwarren,项目名称:AGDeviceControl,代码行数:30,代码来源:posixbase.py
示例7: execute
self.args = args
self.kwargs = kwargs
def execute(self, svc, commandTime):
if not hasattr(self, "obj"):
obj = svc.loadObject(self.objType, self.objId)
else:
obj = self.obj
return getattr(obj, self.methodName)(*self.args, **self.kwargs)
def __getstate__(self):
d = self.__dict__.copy()
del d["obj"]
return d
components.backwardsCompatImplements(WrapperCommand)
def command(methodName, cmdClass=WrapperCommand):
"""Wrap a method so it gets turned into command automatically.
For use with Wrappables.
Usage::
| class Foo(Wrappable):
| objectType = "foo"
| def getUid(self):
| return self.id
| def _bar(self, x):
| return x + 1
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:31,代码来源:base.py
示例8: _Reporter
from twisted.trial.itrial import IReporter
from twisted.plugin import IPlugin
class _Reporter(object):
implements(IPlugin, IReporter)
def __init__(self, name, module, description, longOpt, shortOpt, klass):
self.name = name
self.module = module
self.description = description
self.longOpt = longOpt
self.shortOpt = shortOpt
self.klass = klass
backwardsCompatImplements(_Reporter)
Tree = _Reporter("Tree Reporter",
"twisted.trial.reporter",
description="verbose color output (default reporter)",
longOpt="verbose",
shortOpt="v",
klass="TreeReporter")
BlackAndWhite = _Reporter("Black-And-White Reporter",
"twisted.trial.reporter",
description="Colorless verbose output",
longOpt="bwverbose",
shortOpt="o",
klass="VerboseTextReporter")
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:29,代码来源:twisted_trial.py
示例9: detached
"""
log.msg('attached [%s]' % reflect.qual(self.__class__))
self._attachedCount = self._attachedCount + 1
if self._attachedCount == 1:
self.service.cachePerspective(self)
else:
log.msg(" (multiple references attached: %s)" % self._attachedCount)
return self
def detached(self, reference, identity):
"""Called when a broker is 'detached' from me.
See 'attached'.
When a remote actor disconnects (or times out, for example,
with HTTP), this is called in order to indicate that the
reference associated with that peer is no longer attached to
this perspective.
"""
log.msg('detached [%s]' % reflect.qual(self.__class__))
self._attachedCount = self._attachedCount - 1
if self._attachedCount <= 0:
self.service.uncachePerspective(self)
if self._attachedCount < 0:
log.msg(" (Weird stuff: attached count = %s)" % self._attachedCount)
else:
log.msg(" (multiple references attached: %s)" % self._attachedCount)
return self
components.backwardsCompatImplements(Perspective)
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:30,代码来源:perspective.py
注:本文中的twisted.python.components.backwardsCompatImplements函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论