[Twisted-Python] Handling UnauthorizedLogin Exception with PB

Justin Johnson justinjohnson at fastmail.fm
Wed Jan 14 15:04:12 EST 2004


I have a PB server that uses new cred and the FileUserPasswordDB checker
for authentication.  When users attempt to login with the incorrect
username/password, a twisted.cred.error.UnauthorizedLogin exception is
raised and logged on the server.  The exception doesn't get passed back
to the client though.  On the client side I have a deferred with multiple
callbacks added and a single errback added to the end as follows:

    def mkrepexport(self, vobs, group, original_site, sites):

        [...]

        def _cbFailure(failure, site):
            self.resultsTable.failures.append(["None","None",
                Exception("Failure at site '%s'! The error is '%s'." %
                (site, str(failure)) )])
            return failure
            
        [...]

        deferreds = []
        for vob in vobs:
            for site in sites:
                ## Connect to exporting site
                d =
                self.connectToServer(config.siteToServer[original_site])
                ## Export the VOB to the site
                d.addCallback(_cbExport, vob,
                site).addErrback(_cbFailure, original_site)
                ## Connect to the importing site and import the VOB
                d.addCallback(_cbInitiateImport, vob, group,
                site).addErrback(_cbFailure, site)
                ## Add to the list of Deferreds
                deferreds.append(d)
                
        ## Stop the reactor when complete
        return defer.DeferredList(deferreds).addBoth(_cbStop)


When I attempt to login with an incorrect password, I get the following
output:



     Task: None, Step: None, Failure: Failure at site 'stby'! The error
     is '[Failure instance: Traceback from remote host -- Traceback
     unavailable]'.

Traceback from remote host -- Traceback unavailable


Is there something special I need to do to get the exception information
passed back to the client?

Thanks.
-Justin




More information about the Twisted-Python mailing list