bitly/asyncmongo — pull request #40 by ahassany (2012-01-31 17:52:07+00:00)
Title: Give the ability to pass arguments to the backend

The current backend interface doesn't have anyway for the user to pass arguments to it. At least in the tornado backend, sometime it's needed to pass the IOLoop instance to the IOStream.

For example:

```python
from tornado.testing import AsyncTestCase
import asyncmongo

class AsyncTest(AsyncTestCase):
def test_insert(self):
db = asyncmongo.Client(pool_id='testinsert', host='127.0.0.1', port=27017, dbname='test')
db.test_users.insert({"one" : 1}, callback=self.insert_callback)
self.wait()

def insert_callback(self, response, error=None):
self.assertEqual(1, 1)
self.stop()
```

will hang forever because IOStream created another IOLoop instance different from the unittest IOLoop instance.

But with this update, it can be fixed by connecting using

```python
db = asyncmongo.Client(pool_id='testinsert', host='127.0.0.1', port=27017, dbname='test', io_loop=self.io_loop)
```

BTW, I have not test this with GLib backend.