mahmoud/wapiti — pull request #23 by BurntSushi (2014-08-01 11:52:59+00:00)
Title: Fixes a bug where the client configuration is lost in sub-operations.

I came across this when I was trying to launch a large request (>500 titles) with `is_bot=True`. The expected behavior is that this would chunk the requests into sizes suitable for a bot (500 titles per request), but it ended up chunking them into 50 titles per request. The cause of it seems to be that the client state is not always passed to sub operations, which means the initial configuration is lost (and `is_bot` reverts to its default `False`).

More insidiously, this ended up falling back to the default `MockClient` with the default web client---which sends your email address along with the request.

I also changed a few more places where ops were being enqueued without the client state being passed.

I've added a regression test that will fail if a sub-operation has a different client object than the one given initially.

I'm still finding my way around your code, so I don't know if this is the optimal fix. I debated between what I have now and adding `client` as a proper attribute of `OperationQueue`. I decided on what I have now because it was a smaller change, but it is less robust with respect to future uses of `enqueue` (you always have to remember to pass the client along).