It's possible that in some of the cases discussed above, what you want is a custom *Portal*. For example, if you want to try a sequence of logins, and choose the first that succeeds:
class MultiPortal(object): def __init__(self, portals): self.portals = portals @inlineCallbacks def login(self, *args, **kwargs): for portal in self.portals: try: return portal.login(*args, **kwargs) except: continue # Ran out of portals, failed to login: raise Unauthorized() Or, let's say you're writing a backend that is a combination checker and realm, where separating that two doesn't make sense. E.g. a backend for a POP3 server that is a proxy to another POP3 server. In this case there's no point in writing separate checker and realm, just write a new Portal: class POP3ProxyPortal(object): def __init__(self, endpoint): self.endpoint = endpoint @defer.inlineCallbacks def login(self, credentials, mind, *interfaces): pop3client = yield self.endpoint.connect(POP3ClientFactory()) yield pop3client.login(credentials.username, credentials.password) defer.returnValue((IMailbox, MailboxProxy(pop3client), pop3client.quit)) -- Itamar Turner-Trauring, Future Foundries LLC http://futurefoundries.com/ — Twisted consulting, training and support.
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python