rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
os.path.join(os.getcwd(), 'sftp_test', 'testfile1'))
os.path.join(os.getcwd(), self.test_dir, 'testfile1'))
def _readLink(_): d = self.client.readLink('testLink') self._emptyBuffers() d.addCallback(self.failUnlessEqual, os.path.join(os.getcwd(), 'sftp_test', 'testfile1')) return d
os.path.join(os.getcwd(), 'sftp_test', 'testfile1'))
os.path.join(os.getcwd(), self.test_dir, 'testfile1'))
def _realPath(_): d = self.client.realPath('testLink') self._emptyBuffers() d.addCallback(self.failUnlessEqual, os.path.join(os.getcwd(), 'sftp_test', 'testfile1')) return d
if (dav_namespace, "getcontenttype") in self.dead_properties: return self.dead_properties[(dav_namespace, "getcontenttype")]
if (davxml.dav_namespace, "getcontenttype") in self.dead_properties: return self.dead_properties[(davxml.dav_namespace, "getcontenttype")]
def contentType(self): # Allow dead property to override if (dav_namespace, "getcontenttype") in self.dead_properties: return self.dead_properties[(dav_namespace, "getcontenttype")] else: return super(DAVFile, self).contentType()
if (dav_namespace, "displayname") in self.dead_properties: return self.dead_properties[(dav_namespace, "displayname")]
if (davxml.dav_namespace, "displayname") in self.dead_properties: return self.dead_properties[(davxml.dav_namespace, "displayname")]
def displayName(self): # Allow dead property to override if (dav_namespace, "displayname") in self.dead_properties: return self.dead_properties[(dav_namespace, "displayname")] else: return super(DAVFile, self).displayName()
whenDone()
task.schedule(whenDone)
def __init__(self, host, port, protocol, timeout=None, connector=None): """Initialize the client, setting up its socket, and request to connect. """ if host == 'unix': # "port" in this case is really a filename try: mode = os.stat(port)[0] except OSError, ose: protocol.connectionFailed() # no such file or directory re...
self.application.removeIdentity("web")
self.application.authorizer.removeIdentity("web")
def upgradeToVersion2(self): self.application.removeIdentity("web") del self.application.services[self.serviceName] del self.serviceName del self.application del self.perspectiveName
self._listenerDict = []
self._listenerDict = {}
def __init__(self, name, uid=None, gid=None, authorizer=None, authorizer_=None): """Initialize me.
manager.loadObjectsFrom("testrooms").addCallback(gotDBRooms)
manager.loadObjectsFrom("testrooms").addCallbacks(gotDBRooms, fail) def fail(failure): print "FAILURE" print failure.getErrorMessage() reactor.stop()
def runTests(ignore=0): global manager print "running tests." manager.loadObjectsFrom("testrooms").addCallback(gotDBRooms)
print "no rooms found!" main.shutDown()
raise DataException, "no rooms found!"
def dumpRooms(rooms): if not rooms: print "no rooms found!" main.shutDown() for room in rooms: print " ", room for child in room.furniture: print " ", child if hasattr(child, "childRows"): for inner in child.childRows: print " ", inner
for obj in xmanager.rowCache.values():
for obj in manager.rowCache.values():
def gotDBRooms(rooms): print "------------ got rooms from database ------------" dumpRooms(rooms) for obj in xmanager.rowCache.values(): xmanager.insertRow(obj) xmanager.loadObjectsFrom("testrooms", data=None, whereClause=[("roomId",reflector.EQUAL, 12)]).addCallback(gotXMLRooms)
xmanager.loadObjectsFrom("testrooms", data=None, whereClause=[("roomId",reflector.EQUAL, 12)]).addCallback(gotXMLRooms)
d = xmanager.loadObjectsFrom("testrooms", data=None, whereClause=[("roomId",reflector.EQUAL, 12)]) d.addCallback(gotXMLRooms) d.addErrback(fail)
def gotDBRooms(rooms): print "------------ got rooms from database ------------" dumpRooms(rooms) for obj in xmanager.rowCache.values(): xmanager.insertRow(obj) xmanager.loadObjectsFrom("testrooms", data=None, whereClause=[("roomId",reflector.EQUAL, 12)]).addCallback(gotXMLRooms)
xmanager.loadObjectsFrom("testrooms", data=None, whereClause=[("roomId",reflector.EQUAL, 12)]).addCallback(gotXMLRooms2)
d = xmanager.loadObjectsFrom("testrooms", data=None, whereClause=[("roomId",reflector.EQUAL, 12)]) d.addCallback(gotXMLRooms2) d.addErrback(fail)
def gotXMLRooms(rooms): print "------------ got rooms from XML ------------" dumpRooms(rooms) xmanager.loadObjectsFrom("testrooms", data=None, whereClause=[("roomId",reflector.EQUAL, 12)]).addCallback(gotXMLRooms2)
main.shutDown()
reactor.stop()
def gotXMLRooms2(rooms): print "------------ got rooms from XML again! ------------" main.shutDown()
main.addTimeout(tick, 0.5)
reactor.callLater(0.5, tick)
def tick(): main.addTimeout(tick, 0.5)
dbpool = adbapi.ConnectionPool("pyPgSQL.PgSQL", database="sean", host="localhost", port=5432)
dbpool = adbapi.ConnectionPool("pyPgSQL.PgSQL", database="test")
def tick(): main.addTimeout(tick, 0.5)
manager = sqlreflector.SQLReflector(dbpool, [RoomRow, FurnitureRow, RugRow, LampRow], runTests)
manager = sqlreflector.SQLReflector(dbpool, [RoomRow, FurnitureRow, RugRow, LampRow]) runTests()
def kickOffTests(ignoredResult=0): global manager, xmanager xmanager = xmlreflector.XMLReflector("myXMLdb", [RoomRow, FurnitureRow, RugRow, LampRow] ) manager = sqlreflector.SQLReflector(dbpool, [RoomRow, FurnitureRow, RugRow, LampRow], runTests)
main.addTimeout(tick, 0.5) main.addTimeout(kickOffTests, 0.4)
reactor.callLater(0.5, tick) reactor.callLater(0.4, kickOffTests)
def kickOffTests(ignoredResult=0): global manager, xmanager xmanager = xmlreflector.XMLReflector("myXMLdb", [RoomRow, FurnitureRow, RugRow, LampRow] ) manager = sqlreflector.SQLReflector(dbpool, [RoomRow, FurnitureRow, RugRow, LampRow], runTests)
def initialize(self):
def setUp(self, request, node, data):
def initialize(self): self['type'] = 'checkbox'
def initialize(self):
def setUp(self, request, node, data):
def initialize(self): self['type'] = 'radio'
def initialize(self):
def setUp(self, request, node, data):
def initialize(self): self['type'] = 'file'
def setUp(self, request, node, m):
def setUp(self, request, node, data):
def setUp(self, request, node, m): self['type'] = 'hidden'
def initialize(self):
def setUp(self, request, node, data):
def initialize(self): self['type'] = 'text'
def initialize(self):
def setUp(self, request, node, data):
def initialize(self): self['type'] = 'password'
def initialize(self):
def setUp(self, request, node, data):
def initialize(self): self['type'] = 'button'
seq = domhelpers.getIfExists(newNode,'listIndex') if seq: seq.setAttribute('value',str(itemNum))
def _iterateData(self, parentNode, submodel, data): currentListItem = 0 for itemNum in range(len(data)): # theory: by appending copies of the li node # each node will be handled once we exit from # here because handleNode will then recurse into # the newly appended nodes
parentNode.appendChild(newNode)
retVal[itemNum] = newNode newNode.parentNode = parentNode parentNode.childNodes.extend(retVal)
def _iterateData(self, parentNode, submodel, data): currentListItem = 0 for itemNum in range(len(data)): # theory: by appending copies of the li node # each node will be handled once we exit from # here because handleNode will then recurse into # the newly appended nodes
def quote(s): return urllib.quote(s)
def testData(self): for entry in self.data: raw = entry[0] quoted = entry[1:]
def quote(s): return urllib.quote(s)
def unquote(s): return urllib.unquote(s)
self.assertEquals(postfix.quote(raw), quoted[0]) for q in quoted: self.assertEquals(postfix.unquote(q), raw)
def unquote(s): return urllib.unquote(s)
class PostfixTCPMapServer(basic.LineReceiver, policies.TimeoutMixin): """Postfix mail transport agent TCP map protocol implementation.
class PostfixTCPMapServerTestCase: data = { }
def unquote(s): return urllib.unquote(s)
Receive requests for data matching given key via lineReceived, asks it's factory for the data with dictionary-style access, and returns the data to the requester.
chat = [ ]
def unquote(s): return urllib.unquote(s)
You can use postfix's postmap to test the map service::
def testChat(self): factory = postfix.PostfixTCPMapDictServerFactory(self.data) output = StringIOWithoutClosing() transport = internet.protocol.FileWrapper(output)
def unquote(s): return urllib.unquote(s)
/usr/sbin/postmap -q KEY tcp:localhost:4242
protocol = postfix.PostfixTCPMapServer() protocol.service = factory protocol.factory = factory protocol.makeConnection(transport)
def unquote(s): return urllib.unquote(s)
"""
for input, expected_output in self.chat: protocol.lineReceived(input) self.assertEquals(output.getvalue(), expected_output) output.truncate(0) protocol.setTimeout(None)
def unquote(s): return urllib.unquote(s)
timeout = 600 delimiter = '\n' def connectionMade(self): self.setTimeout(self.timeout) def sendCode(self, code, message=''): "Send an SMTP-like code with a message." self.sendLine('%3.3d %s' % (code, message or '')) def lineReceived(self, line): self.resetTimeout() splitted = line.split(None) request = splitted[0] p...
class Valid(PostfixTCPMapServerTestCase, unittest.TestCase): data = { 'foo': 'ThisIs Foo', 'bar': ' bar really is found\r\n', } chat = [ ('get', "400 Command 'get' takes 1 parameters.\n"), ('get foo bar', "400 Command 'get' takes 1 parameters.\n"), ('put', "400 Command 'put' takes 2 parameters.\n"), ('put foo', "400 Co...
def unquote(s): return urllib.unquote(s)
def getStateFor(self, actor):
def getStateFor(self, jellier):
def getStateFor(self, actor): return self.__dict__
jellier.jelly(self.getStateFor(actor))])
jellier.jelly(self.getStateFor(jellier))])
def jellyFor(self, jellier): sxp = jellier.prepare(self) sxp.extend([ str(self.__class__), jellier.jelly(self.getStateFor(actor))]) return jellier.preserve(self, sxp)
if len(self.data) != 5 or True:
if len(self.data) != 5:
def processEnded(self, reason): self.data = self.data.lstrip("a") if len(self.data) != 5 or True: self.elapsed = ValueError # XXX! else: self.elapsed = float(self.data)
reactor.clientTCP("localhost", 10081, client)
reactor.clientTCP("localhost", 10081, client, timeout=5)
def testFailing(self): client = ClosingProtocol() reactor.clientTCP("localhost", 10081, client)
pass
if params: target = params[0] else: target = self.nickname
def irc_WHOIS(self, prefix, params): """Whois query
if params:
if params and params[0]:
def irc_AWAY(self, prefix, params): """Away
self.sendMessage("306", "You are now away.")
self.sendMessage(irc.RPL_NOWAWAY, "You are now away.")
def irc_AWAY(self, prefix, params): """Away
self.sendMessage("305", "You are no longer away.")
self.sendMessage(irc.RPL_UNAWAY, "You are no longer away.")
def irc_AWAY(self, prefix, params): """Away
if node.attributes.has_key('model'): del node.attributes['model'] if node.attributes.has_key('view'): del node.attributes['view'] if node.attributes.has_key('controller'): del node.attributes['controller']
if not DEBUG: if node.attributes.has_key('model'): del node.attributes['model'] if node.attributes.has_key('view'): del node.attributes['view'] if node.attributes.has_key('controller'): del node.attributes['controller']
def cleanNode(self, node): """ Do your part, prevent infinite recursion! """ if node.attributes.has_key('model'): del node.attributes['model'] if node.attributes.has_key('view'): del node.attributes['view'] if node.attributes.has_key('controller'): del node.attributes['controller'] return node
if not self.outstandingCallbacks:
if isCallback and not self.outstandingCallbacks:
def handleControllerResults(self, controllerResult, request, node, controller, view, success): self.outstandingCallbacks -= 1 if isinstance(controllerResult, type(())): success, data = controllerResult else: data = controllerResult if isinstance(data, defer.Deferred): self.outstandingCallbacks += 1 data.addCallback(sel...
self.sendNegativeResponse(tag, 'Authentication failed: ' + str(falure.value))
self.sendNegativeResponse(tag, 'Authentication failed: ' + str(failure.value))
def __ebAuthChunk(self, failure, tag): self.sendNegativeResponse(tag, 'Authentication failed: ' + str(falure.value))
raise IllegalServerResponse(line)
raise IllegalServerResponse(parts)
def __cbSelect(self, (lines, tagline), rw): # In the absense of specification, we are free to assume: # READ-WRITE access datum = {'READ-WRITE': rw} lines.append(tagline) for parts in lines: split = parts.split() if len(split) == 2: if split[1].upper().strip() == 'EXISTS': try: datum['EXISTS'] = int(split[0]) except ...
'default': getattr(self, opt, None)
'default': self.opts.get(opt, None)
def __str__(self, width=None): if not width: width = int(os.environ.get('COLUMNS', '80'))
obj = keys.getPublicKeyObject(options['filename'])
obj = keys.getPublicKeyObject(string)
def printFingerprint(options): if not options['filename']: filename = os.path.expanduser('~/.ssh/id_rsa') options['filename'] = raw_input('Enter file in which the key is (%s): ' % filename) if os.path.exists(options['filename']+'.pub'): options['filename'] += '.pub' try: string = keys.getPublicKeyString(options['filena...
ss = self._grabService(s)
ss = self._grabService(s, sclas)
def _grabService(self, svc, sclas): """ Find an instance of a particular class in a service collection and all subcollections. """ for s in svc.services.values(): if isinstance(s, sclas): return s if components.implements(s, IServiceCollection): ss = self._grabService(s) if ss: return ss
f = open(self.path,'rb')
f = self.openForReading()
def render(self, request): """You know what you doing."""
return File(path, self.defaultType, self.allowExt, self.registry)
return self.__class__(path, self.defaultType, self.allowExt, self.registry)
def createSimilarFile(self, path): return File(path, self.defaultType, self.allowExt, self.registry)
self.setHeader('content-length', str(len(body)-1))
self.setHeader('content-length', len(body))
def process(self): "Process a request." print "RESULT: Processing!?#!" # Log the request to a file. log.msg( self )
return "Directory Listing For %s" % request.path[:-len('.idx')]
return "Directory Listing For %s" % request.path
def pagetitle(self, request): return "Directory Listing For %s" % request.path[:-len('.idx')]
if path == '.idx': if os.path.exists(os.path.join(self.path,self.indexName)): return error.NoResource() else: return DirectoryListing(self.path)
def getChild(self, path, request): """ Move 'zig'. For great justice. """ if path == '..': return error.NoResource() if path == '.idx': if os.path.exists(os.path.join(self.path,self.indexName)): return error.NoResource() else: return DirectoryListing(self.path) if path == '': path = self.indexName # This next step is s...
request.prepath[-1] = self.indexName
if os.path.exists(os.path.join(self.path,self.indexName)): request.prepath[-1] = self.indexName else: return DirectoryListing(self.path)
def getChild(self, path, request): """ Move 'zig'. For great justice. """ if path == '..': return error.NoResource() if path == '.idx': if os.path.exists(os.path.join(self.path,self.indexName)): return error.NoResource() else: return DirectoryListing(self.path) if path == '': path = self.indexName # This next step is s...
if os.path.basename(self.path) == self.indexName: request.setResponseCode(http.MOVED_PERMANENTLY) request.setHeader("location","http://%s%s.idx" % ( request.getHeader("host"), (string.split(request.uri,'?')[0]))) return ' '
def render(self, request): "You know what you doing." try: mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime =\ os.stat(self.path) except OSError: # This part is quite hacky, but it gets the job done. What I'm # saying here is to redirect to .idx (the directory index) if this # is supposed to be an index.html...
if os.path.exists(os.path.join(self.path,self.indexName)): loc = '' else: loc = '.idx' request.setHeader("location","http://%s%s/%s" % (
request.setHeader("location","http://%s%s/" % (
def render(self, request): "You know what you doing." try: mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime =\ os.stat(self.path) except OSError: # This part is quite hacky, but it gets the job done. What I'm # saying here is to redirect to .idx (the directory index) if this # is supposed to be an index.html...
(string.split(request.uri,'?')[0]), loc))
(string.split(request.uri,'?')[0])))
def render(self, request): "You know what you doing." try: mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime =\ os.stat(self.path) except OSError: # This part is quite hacky, but it gets the job done. What I'm # saying here is to redirect to .idx (the directory index) if this # is supposed to be an index.html...
mutable[0] = (reactor.clientTCP(host, port, protocol, 30.0))
mutable[0] = reactor.clientTCP(host, port, protocol, 30.0)
abcdef = re.sub('[^0-9, ]', '', line[4:])
pasvCmd.deferred.addCallbacks(doPassive, self.fail).arm()
pasvCmd.deferred.addCallbacks(doPassive, self.fail) pasvCmd.deferred.addErrback(lambda e,p=protocol: p.deferred.errback(e) or e) pasvCmd.deferred.arm()
abcdef = re.sub('[^0-9, ]', '', line[4:])
self.queueCommand(cmd)
abcdef = re.sub('[^0-9, ]', '', line[4:])
return cmd.deferred
cmd.deferred.addErrback(lambda e,p=protocol: p.deferred.errback(e) or e) d = DeferredList([cmd.deferred, protocol.deferred])
abcdef = re.sub('[^0-9, ]', '', line[4:])
class ProtocolWrapper(ObjectWrapper): def connectionLost(self): self.object.connectionLost() self.portCmd.transferDeferred.callback(None)
abcdef = re.sub('[^0-9, ]', '', line[4:])
portCmd.protocol.portCmd = portCmd
def connectionLost(self): self.object.connectionLost() # Signal that transfer has completed self.portCmd.transferDeferred.callback(None)
d = DeferredList([portCmd.deferred, portCmd.transferDeferred, cmd.deferred]) def raiseOnFailure(deferredListResult): """Triggers errback if one (or more) of the Deferreds failed""" for status, value in deferredListResult: if status == FAILURE: raise value return deferredListResult[2][1] d.addCallback(raiseOnFailure)...
d = DeferredList([cmd.deferred, portCmd.deferred, portCmd.transferDeferred]) d.addCallback(raiseOnFailure) self.queueCommand(cmd) return d
def connectionLost(self): self.object.connectionLost() # Signal that transfer has completed self.portCmd.transferDeferred.callback(None)
if not _logDateTimeUsers and _resetLogDateTimeID:
if (not _logDateTimeUsers and _resetLogDateTimeID and _resetLogDateTimeID.active()):
def _logDateTimeStop(): global _logDateTimeUsers _logDateTimeUsers -= 1; if not _logDateTimeUsers and _resetLogDateTimeID: _resetLogDateTimeID.cancel()
if len(args) != len(self.llist): raise TypeError("Wrong number of args, foo'!")
def __call__(self, *args): if len(args) != len(self.llist): raise TypeError("Wrong number of args, foo'!")
raise ParseError(*((el.tagName, name)+self.saveMark()+el._markpos))
raise MismatchedTags(*((el.tagName, name)+self.saveMark()+el._markpos))
def gotTagEnd(self, name): if self.caseInsensitive: name = name.lower() if self._shouldAutoClose == name: self._shouldAutoClose = '' else: self._autoclose() el = self.elementstack.pop() if el.tagName != name: raise ParseError(*((el.tagName, name)+self.saveMark()+el._markpos)) if not self.elementstack: self.documents.ap...
if hasattr(request, 'postpath') and not request.postpath and request.uri[-1] != '/':
if hasattr(request, 'postpath') and not request.postpath and string.split(request.uri,'?')[0][-1] != '/':
def getChild(self, path, request): """See twisted.web.Resource.getChild. """ if path == '..': return error.NoResource("Invalid request URL.")
if hasattr(request, 'postpath') and not request.postpath and not self.getIndex(request):
if hasattr(request, 'postpath') and not request.postpath and \ not self.getIndex(request):
def getChild(self, path, request): """See twisted.web.Resource.getChild. """ if path == '..': return error.NoResource("Invalid request URL.")
def ids(lst): ret = [] for x in lst: ret.append(id(x)) return ret
def ids(lst): ret = [] for x in lst: ret.append(id(x)) return ret
"""Initialize with a RemoteReference and the name of this message.
"""Initialize with a L{RemoteReference} and the name of this message.
def __init__(self, obj, name): """Initialize with a RemoteReference and the name of this message. """ self.obj = obj self.name = name
RemoteReference to a Perspective. When a method is called on that RemoteReference, it will translate to a method on the remote
L{RemoteReference} to a Perspective. When a method is called on that L{RemoteReference}, it will translate to a method on the remote
def printTraceback(tb): """Print a traceback (string) to the standard log. """ log.msg('Perspective Broker Traceback:' ) log.msg(tb)
on invoking methods on other objects, see ViewPoint.)
on invoking methods on other objects, see L{flavors.ViewPoint}.)
def printTraceback(tb): """Print a traceback (string) to the standard log. """ log.msg('Perspective Broker Traceback:' ) log.msg(tb)
twisted.cred.perspective.Perspective.attached; however, this method
L{twisted.cred.perspective.Perspective}.attached; however, this method
def brokerAttached(self, reference, identity, broker): """An intermediary method to override.
"""See brokerAttached.
"""See L{brokerAttached}.
def brokerDetached(self, reference, identity, broker): """See brokerAttached. """ return self.detached(reference, identity)
self.perspective_%(message)s(*broker.unserialize(args), **broker.unserialize(kw))
| self.perspective_%(message)s(*broker.unserialize(args), | **broker.unserialize(kw))
def perspectiveMessageReceived(self, broker, message, args, kw): """This method is called when a network message is received.
pb.Perspective rather than a perspective.Perspective.
L{pb.Perspective} rather than a L{twisted.cred.perspective.Perspective}.
def perspectiveMessageReceived(self, broker, message, args, kw): """This method is called when a network message is received.
I may be a reference to a ViewPoint, a Referenceable, or a Perspective. From the client's perspective, it is not possible to tell which except by convention.
I may be a reference to a L{flavors.ViewPoint}, a L{flavors.Referenceable}, or a L{Perspective}. From the client's perspective, it is not possible to tell which except by convention.
def __init__(self, object, messageType="remote"): """Initialize me with an object. """ self.remoteMessageReceived = getattr(object, messageType + "MessageReceived")
See also twisted.internet.defer.
See also L{twisted.internet.defer}.
def __init__(self, object, messageType="remote"): """Initialize me with an object. """ self.remoteMessageReceived = getattr(object, messageType + "MessageReceived")
Arguments: * name: the name of the remote method to invoke * *args: arguments to serialize for the remote function * **kw: keyword arguments to serialize for the remote function. Returns: a Deferred which will be fired when the result of this remote call is received.
@type name: C{string} @param name: the name of the remote method to invoke @param args: arguments to serialize for the remote function @param kw: keyword arguments to serialize for the remote function. @rtype: L{twisted.internet.defer.Deferred} @returns: a Deferred which will be fired when the result of this remo...
def callRemote(self, name, *args, **kw): """Asynchronously invoke a remote method.
"""Get a RemoteMethod for this key.
"""Get a L{RemoteMethod} for this key.
def remoteMethod(self, key): """Get a RemoteMethod for this key. """ return RemoteMethod(self, key)
"""Compare me [to another RemoteReference].
"""Compare me [to another L{RemoteReference}].
def __cmp__(self,other): """Compare me [to another RemoteReference]. """ if isinstance(other, RemoteReference): if other.broker == self.broker: return cmp(self.luid, other.luid) return cmp(self.broker, other)
"""Respond to stock 'didNotUnderstand' message.
"""Respond to stock 'C{didNotUnderstand}' message.
def proto_didNotUnderstand(self, command): """Respond to stock 'didNotUnderstand' message.
self.registerReference, or None if XXX:Unfinished thought:XXX
self.L{registerReference}, or C{None} if XXX:Unfinished thought:XXX
def localObjectForID(self, luid): """Get a local object for a locally unique ID.
"""Returns an ID that says what this instance is cached as remotely, or None if it's not.
"""Returns an ID that says what this instance is cached as remotely, or C{None} if it's not.
def cachedRemotelyAs(self, instance, incref=0): """Returns an ID that says what this instance is cached as remotely, or None if it's not. """
"""I delegate most functionality to a identity.Identity.
"""I delegate most functionality to a L{twisted.cred.identity.Identity}.
def detach(self): self.perspective.brokerDetached(self.remoteRef, self.identity, self.broker)
See also: AuthRoot
See also: L{AuthRoot}
def _authFail(self, result, d): d.callback(None)
"""(Internal) Does callbacks for getObjectAt.
"""(Internal) Does callbacks for L{getObjectAt}.
def mkchallenge(self, ident): if type(ident) == types.StringType: # it's an error, so we must fail. challenge = identity.challenge() return challenge, AuthChallenger(None, self, challenge) else: challenge = ident.challenge() return challenge, AuthChallenger(ident, self, challenge)
@returns A pair: A ClientFactory and a Deferred which will be passed a remote reference to the root object of a PB server.x
@returns: A pair: A ClientFactory and a Deferred which will be passed a remote reference to the root object of a PB server.x
def getObjectRetreiver(): """Get a factory which retreives a root object from its client @returns A pair: A ClientFactory and a Deferred which will be passed a remote reference to the root object of a PB server.x """ d = defer.Deferred() b = Broker(1) bf = BrokerClientFactory(b) _ObjectRetrieval(b, d) return bf, d
"""Establishes a PB connection and returns with a RemoteReference.
"""Establishes a PB connection and returns with a L{RemoteReference}.
def getObjectAt(host, port, timeout=None): """Establishes a PB connection and returns with a RemoteReference. @param host: the host to connect to @param port: the port number to connect to @param timeout: a value in milliseconds to wait before failing by default. (OPTIONAL) @returns A Deferred which will be passed ...
@returns A Deferred which will be passed a remote reference to the
@returns: A Deferred which will be passed a remote reference to the
def getObjectAt(host, port, timeout=None): """Establishes a PB connection and returns with a RemoteReference. @param host: the host to connect to @param port: the port number to connect to @param timeout: a value in milliseconds to wait before failing by default. (OPTIONAL) @returns A Deferred which will be passed ...
@returns A Deferred which will be passed a remote reference to the
@returns: A Deferred which will be passed a remote reference to the
def getObjectAtSSL(host, port, timeout=None): """Establishes a PB connection over SSL and returns with a RemoteReference. @param host: the host to connect to @param port: the port number to connect to @param timeout: a value in milliseconds to wait before failing by default. (OPTIONAL) @returns A Deferred which wi...
host -- the host the service is running on port -- the port on the host to connect to username -- the name you will be identified as to the authorizer password -- the password for this username serviceName -- name of the service to request
- host -- the host the service is running on - port -- the port on the host to connect to - username -- the name you will be identified as to the authorizer - password -- the password for this username - serviceName -- name of the service to request
def connect(host, port, username, password, serviceName, perspectiveName=None, client=None, timeout=None): """Connects and authenticates, then retrieves a PB service. Required arguments: host -- the host the service is running on port -- the port on the host to connect to username -- the name you will be identified as...
perspectiveName -- the name of the perspective to request, if
- perspectiveName -- the name of the perspective to request, if
def connect(host, port, username, password, serviceName, perspectiveName=None, client=None, timeout=None): """Connects and authenticates, then retrieves a PB service. Required arguments: host -- the host the service is running on port -- the port on the host to connect to username -- the name you will be identified as...
client -- XXX the \"reference\" argument to
- client -- XXX the \"reference\" argument to
def connect(host, port, username, password, serviceName, perspectiveName=None, client=None, timeout=None): """Connects and authenticates, then retrieves a PB service. Required arguments: host -- the host the service is running on port -- the port on the host to connect to username -- the name you will be identified as...
timeout -- see twisted.internet.tcp.Client Returns: A Deferred instance that gets a callback when the final Perspective is connected, and an errback when an error occurs at any stage of connecting.
- timeout -- see twisted.internet.tcp.Client @returns: A Deferred instance that gets a callback when the final Perspective is connected, and an errback when an error occurs at any stage of connecting.
def connect(host, port, username, password, serviceName, perspectiveName=None, client=None, timeout=None): """Connects and authenticates, then retrieves a PB service. Required arguments: host -- the host the service is running on port -- the port on the host to connect to username -- the name you will be identified as...
if self.childNodes or self.tagName.lower() in ('a', 'li', 'div', 'span'):
if self.childNodes or self.tagName.lower() in ('a', 'li', 'div', 'span', 'title'):
def writexml(self, stream, indent='', addindent='', newl='', strip=0): # write beginning w = stream.write w(newl+indent+"<") w(self.tagName) for attr, val in self.attributes.items(): w(" ") w(attr) w("=") w('"') w(html.escape(val)) w('"') if self.childNodes or self.tagName.lower() in ('a', 'li', 'div', 'span'): w(">") ...
reactor.clientTCP('localhost', FTP_PORT, client)
factory = ClientFactory() factory.buildProtocol = lambda s, c=client: c reactor.connectTCP('localhost', FTP_PORT, factory)
def testFileListings(self): if hasattr(self, 'result'): del self.result
reactor.clientTCP('localhost', FTP_PORT, client)
factory = ClientFactory() factory.buildProtocol = lambda s, c=client: c reactor.connectTCP('localhost', FTP_PORT, factory)
def testRetr(self): if hasattr(self, 'result'): del self.result