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

Hynek Schlawack hs at ox.cx
Wed Jan 9 11:04:05 MST 2013


Am 09.01.2013 um 14:04 schrieb Jan Urbański <wulczer at wulczer.org>:

>> http://twistedmatrix.com/documents/current/core/howto/cred.html says
>> that the avatarId parameter to IRealm.requestAvatar must be a string,
>> not even a Unicode string. I'm using LDAP for authentication, and the
>> checker retrieves the full LDAP entry for the user as a side-effect of
>> authentication.
> I remember discussing this on IRC with someone

;)

> not long ago and he 
> pointed me to this thread:
> 
> http://twistedmatrix.com/pipermail/twisted-python/2010-September/022826.html
> 
> I have faced a similar problem myself and after reading the code I've 
> resolved to wilfully disregarding the documentation and passing tuples 
> around, accepting that if it breaks, I get to keep both pieces.

Since my final approach wasn’t mentioned yet: I found it semantically weird to pass the full data in a variable called “avatarId”, so I went with a dict as a cache that both the checker and the realm get passed in on construction. Not pretty but in my eyes still prettier. :)



More information about the Twisted-Python mailing list