histrio/py-couchdb

Why escaping all slashes within path parts?

leifhanack opened this issue · 2 comments

Hi @histrio,

thanks for your great work. Could you help me understand the why behind escaping all slashes within path parts (see utils.py:76)?

My expectation was that the code below should work:

# curl -X PUT http://192.168.59.103:5984/_config/couch_httpd_auth/timeout -d '"42"'
resource = Resource("http://192.168.59.103:5984")
resource.put("_config/couch_httpd_auth/timeout", data='"42"')

The code is almost a one to one copy from the CouchDB REST API (see comment), but unfortunately doesn't work. I have to write the following:

resource = Resource("http://192.168.59.103:5984")
resource.put(["_config", "couch_httpd_auth", "timeout"], data='"10"')

which is IMHO not as readable and as intuitive as the above example.

Thanks, Leif

Hi @leifhanack,
Thank you for your interest in the project, and sorry for late answer.
Honestly I don't remember why backslash escaping is necessary. Perhaps this is because there have been problems with saving docs in the past.
Anyway I need to perform some integration tests without this escaping. I will take them as soon as possible. If all goes well, it will close the #53 issue

Ok, thanks.