when using feed=continuous with changes()
To support tornado.gen mechanism, we'll now on accept callback as a keyword argument for Database.set. Fixes GH-34
You may call either method on the `trombi.Server` instance: - add_user(name, password, callback, doc=None) Add a user with a name, password and a callback. Optionally add the default user doc with the doc arg - get_user(name, callback) Return the user's document - update_user(user_doc, password, callback) Update a user's document. If you want the password not to be changed, use `None` as value. - delete_user(user_doc, callback) Simply delete a user document
…o longer needed(was it?)
This should be abstracted to a more common level, but for now this is sufficient
This commit adds support for Python 3 in such a way that exactly the same code works with both Python 2 and Python 3, i.e. no 2to3 or other conversions are needed. I tested the code by running the unit tests with Python 2.6 and 3.2, and Tornado 2.0. Fixes #23.
Here's a scenario: 1. There's a document mydoc in CouchDB. It has one attachment, file1.txt. 2. The user fetches the document: db.get('mydoc', callback1). 3. The user adds an attachment to the document: doc.attach('file2.txt', 'Hello, World!', callback2) 4. In callback2, the user modifies the document: doc['foo'] = 'bar' db.set(doc, callback3)`. Result: attachment file2.txt is removed from CouchDB. This happens because, in callback2, the document object has the attachments field, but only the attachment file1.txt is listed. In db.set(), an _attachments field with only file1.txt is sent, so CouchDB goes on and removes other attachments, file2.txt in this case. This patch fixes the issue by adding an appropriate stub to document's attachments list when doc.attach() finishes.
If view is queried with include_docs=True, transform the row['doc'] in to a trombi.Document. This also makes a minor API change to the ViewResult object, which now has a new optional argument, db, which defaults to None. Closes GH-17
This reverts commit 5b95953. Automatic JSONing of arguments for changes feed is too problematic
This reverts commit de4eb3e. Automatic JSONing in changes feed is so problematic that parts of it needs further thinking.
- Fix handling of more than one change. This didn't work at all. - Run the handler outside the streaming_callback context, as an ioloop callback. This makes it possible to start new HTTP requests in the handler, e.g. by calling almost any trombi API function. - Issue a warning log message if a changes feed line cannot be parsed as JSON. - Expand on the test case.
Previous behaviour caused all requests to get same HTTPHeaders instance. This caused problems with long polling changes feed when using filters, as the CouchDB received Content-Length in some cases and hang.