Interesting... those portals could be on different Realms too. It would also allow more than one checker to be tried per interface, which would allow (say) a credentials.IUsernamePassword to be tried against different checkers.
Peter. On Sun, Jan 13, 2013, at 14:08, Itamar Turner-Trauring wrote: 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 [1]http://futurefoundries.com/ — Twisted consulting, training and support. _______________________________________________ Twisted-Python mailing list [2]Twisted-Python@twistedmatrix.com [3]http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python References 1. http://futurefoundries.com/ 2. mailto:Twisted-Python@twistedmatrix.com 3. http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python