[Twisted-Python] async returns from DefaultAuthorizer.addIdentity
Authorizer.addCallback's documentation says "Create an identity and make a callback when it has been created." So I figured that meant I should have DefaultAuthorizer return a defer.succeed/fail instead of None/raise. But returning a defer.fail makes test_cred.AuthorizerTestCase.test_addIdent fail, as it has an assertRaises in there. So who is wrong? The documentation, my interpretation of the documentation, or the unit test? "Unit-tests-never-lie"ly yours, - Acap -- The moon is waning gibbous, 70.1% illuminated, 20.2 days old.
On Fri, 2002-09-27 at 15:14, Kevin Turner wrote:
Authorizer.addCallback's Authorizer.addIdentity, I mean.
But returning a defer.fail makes test_cred.AuthorizerTestCase.test_addIdent fail, as it has an assertRaises in there.
and code depends on this synchronous behaviour, including perspective.makeIdentity, which is used in in many .tap-builders' updateApplication, also handled synchronously. -- The moon is waning gibbous, 69.5% illuminated, 20.3 days old.
On 27 Sep 2002 17:06:47 -0700, Kevin Turner <acapnotic@twistedmatrix.com> wrote:
On Fri, 2002-09-27 at 15:14, Kevin Turner wrote:
Authorizer.addCallback's Authorizer.addIdentity, I mean.
But returning a defer.fail makes test_cred.AuthorizerTestCase.test_addIdent fail, as it has an assertRaises in there.
and code depends on this synchronous behaviour, including perspective.makeIdentity, which is used in in many .tap-builders' updateApplication, also handled synchronously.
Not that this isn't an error, but... from what I can see, makeIdentity's results are thrown away by the caller everywhere it's being called. I don't think it would break too terribly much to change it. (The unit tests may just be overzealous.) dbcred seems to return the documented value from this, so in order to get the unit tests to work for a DatabaseAuthorizer we're going to have to fix it anyway. -- | <`'> | Glyph Lefkowitz: Traveling Sorcerer | | < _/ > | Lead Developer, the Twisted project | | < ___/ > | http://www.twistedmatrix.com |
participants (2)
-
Glyph Lefkowitz
-
Kevin Turner