Docs on a.w.i.ICallee.register method wrong?

#1

The docs for autobahn.wamp.interfaces.ICallee.register [1] says:

“When endpoint is an object, then each of the object’s methods that is decorated with autobahn.wamp.register() is automatically registered and a list of Deferreds/Futures is returned that each resolves or rejects as above.”

But when I pass it an object of a class with @register-decorated methods, it seems to return a Deferred that resolves to a list of autobahn.wamp.protocol.Registration, not a list of Deferred.

E.g. with:

registrations = yield self.register(protocol)

yield gatherResults(registrations, consumeErrors=True)

I get an error because gatherResults can’t call .addCallbacks(…) on the items in the list (because they are Registrations). And with:

registrations = self.register(protocol)

yield gatherResults(registrations, consumeErrors=True)

I get an error because registrations is now a Deferred, not a list of Deferred.

Are the docs wrong? If so, what is the most concise way of checking that all registrations succeeded?

Can I just do away with the gatherResults and do:

try:

registrations = yield self.register(protocol)

except ApplicationError as e:

log.err(‘Registration failed: {}’.format(e))

self.leave()

else:

log.msg(’{} endpoints registered’.format(len(registrations)))

?

Thanks for any advice.

Elvis

[1] http://autobahn.ws/python/reference/autobahn.wamp.html#autobahn.wamp.interfaces.ICallee

0 Likes