[Twisted-Python] Must avatarId always be a string?

Marco Giusti marco.giusti at gmail.com
Thu Jan 10 04:14:36 MST 2013


On Thu, Jan 10, 2013 at 12:34:57PM +0200, Adi Roiban wrote:
> On 10 January 2013 12:00, Marco Giusti <marco.giusti at gmail.com> wrote:
> [snip]
> >> My AvatarID Object is just for data.
> >>
> >> Let me describe one of my usage/requirement:
> >>
> >> I have a portal with credentialsChecker for both OS accounts and
> >> application specific accounts.
> >> One can have user "john" both as a local account and/or an application account.
> >> If my credentialsChecker returns only 'john', the Realm will not know
> >> from where to get user's home folder, so the returned AvatarID needs
> >> to signal the "source" of avatarID login so that it can use the same
> >> source for getting account configuration.
[cut]

This could be an overshoot but you can have two portals, use one as
the default and the second one as a fallback. I think the code will be
a little bit cleaner at the checker/realm side at the price of a little
bit of complexity at the login side:

	portal1.login(credentials, None).addErrback(lambda _:
		portal2.login(credentials, peer)).addCallbacks(...)

But I don't know if it is worth the candle.

m.




More information about the Twisted-Python mailing list