couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From He Shiming <heshim...@gmail.com>
Subject URL encode issues with brackets
Date Fri, 07 Jan 2011 08:43:09 GMT
Dear Community,

I'm using CouchDB 1.0.1 and couchdb-python 0.8 . I'm trying to access
a view with multiple keys like this:
?startkey=["developer"]&endkey=["developer",{}]

I've got successful results using FireFox. And I noticed in FireBug
that the URL is encoded this way:
?startkey=[%22developers%22]&endkey=[%22developers%22,{}] (Form 1)

But when I use couchdb-python, it calls python's urllib.urlencode to
encode. The result is:
?startkey=%5B%22developers%22%5D&endkey=%5B%22developers%22%2C+%7B%7D%5D
(Form 2)

And in Form 2, CouchDB didn't appear to recognize the key and gave no
results and no error ({"total_rows":100,"offset":100,"rows":[]}).

The current implementation of couchdb-python calls urllib.urlencode
directly, which doesn't allow specifying safe characters. So to
workaround this problem, it seems I'll have to write my own
equivalent. However I couldn't help but wondering, urllib.urlencode is
doing things pretty standard way. Is this a problem on the
couchdb-python side or CouchDB side? Shouldn't Form 2 and 1 be
equivalent after decoding in CouchDB?

Thanks!
-- 
Best regards,
He Shiming

Mime
View raw message