tswicegood/Dolt — pull request #10 by six8 (2011-11-05 07:54:13+00:00)
Title: Cloneable

I've found Dolt useful and made some changes to make it more usable for some use cases I came across. This might be a little more involved than the direction you're looking for for Dolt. I've updated the README and documented the code for the changes.

The most noticeable change is that attribute and with_* methods return a cloned object. This allows you to re-use Dolt objects. It also eliminates the need to reset the attribute stack. I've also added with_body to make setting the POST body more clear, with_json to specifically send a JSON encoded body, and with_headers to be able to send headers. I also did some cleanup and added more documentation. Because of the addition of with_json and with_body, __call__ always encodes kwargs as query params. This avoids confusion on how sometimes it did form post and sometimes query params. It also allows you to send a form body and have query params.

The one loose end is the mosso api. I wasn't sure about the best way to update that because I'm not familiar with that API or how people are using it with Dolt. In general, instead of using _generate_body, with_json should be used instead. should_contain_values could possibly be a part of with_json, but I also think it's odd that the user doesn't handle wrapping the params with `servers` since they need to know enough about the API in order to use Dolt.