Coder Social home page Coder Social logo

couchquery's People

Contributors

anateus avatar mhubig avatar mikeal avatar ncb000gt avatar nicolaisi avatar temoto avatar trehn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

couchquery's Issues

Add filters to design document also

Currently it is possible to get views from a map inside the source tree, it would be very nice to have the possibility to add filters also to design documents.

So with a map called "filters" and then the name and next a filter.js where the actual filter is stored.

asynchttp is not used

asynchttp is supplied but not used.
But you can use eventlet/gevent monkey-patching and don't bother with sockets at all.

createdb() does not use credentials

the following line of code:
resp = couchquery.createdb('http://nick:banana@localhost:5984/test_couchquery')

...results in the following request:
PUT http://localhost:5984/test_couchquery/

Somewhere along the way, the "credentials" get lost, and are never sent to CouchDB.

sync_design_doc() should ignore directories starting with .

I'm using svn and sync_design_doc chokes on the .svn directories. More specifically, it creates a view with an empty name and no map or reduce functions. This results in a corrupted design doc.

I'd like to propose the following patch in couchquery/init.py starting at line 518:

       for view in os.listdir(directory):
           if view.startswith('.'):
               continue
           v = {}

Option to add header parameter to specify extra headers when PUT/POSTing

There's a "bug" when using NGINX in front of CouchDB, and PUTs. NGINX requires a Content-Length, to accept the request. On other couchDB modules, an option to add an extra header has been added to correct this problem (which is not on couchquery's side, but more on NGINX's strictness).

See http://code.google.com/p/couchdb-python/issues/detail?id=130 or http://groups.google.com/group/couchrest/browse_thread/thread/ed0e251936b391ac for details of headers

createdb() fails to return an "error" response

createdb() includes the following:
assert response.status == 201
...which causes an exception without returning the response body, which in my case was:
str: {"error":"unauthorized","reason":"You are not a server admin."}
If the create db fails, you should still return the reponse, so the caller gets the "reason".

No HTTPS support because HTTP hardcoded

The class Httplib2Client uses 'http://' directly, this cases https not to work (e.g. with Cloudant).

Locally I've monkeypatched it to use a variable called protocol, i.e. s/'http://'/protocol/g with:

if '@' in self.uri:
  protocol = 'https://' if 'https' in self.uri else 'http://'

http404 error

https://travis-ci.org/nicolaisi/couchquery/jobs/17121555

Since I added an extra test case that connects to a server (initially wanted to test SSH connection), it has been passing from my local environment, but when I push to Travis, it fails and returning a Http 404 response.

This means, it is not detecting the view that the had been previously created.

id is not quoted in couchquery.Database.get

(and possibly other relevant places)

>>> db = couchquery.Database(...)
>>> db.get('/bar')
...
... CouchDBDocumentDoesNotExist: No document at id /bar

But a /bar does exist. It should be sending a request with "%2Fbar" but the method fails to correctly quote its argument.

sync_design_doc() does not use credentials

sync_design_doc() does not use credentials

db = cq.Database('http://nick:banana@localhost:5984/test_couchquery') resp = db.create({'name':'Nick','age':42}) if resp.get('ok'): print 'saved doc' # <------ this works db.sync_design_doc('banzai', views_dir) # <----- this does not

I can save a doc, but can not sync_design_doc:

couchquery.CouchDBException: {"error":"unauthorized","reason":"You are not a db or server admin."}

compact is missing

Currently there is no "compact" method. Also the command

result = db.http.post(self.dbConnection.uri + '_compact')

yields a faulty result

https

couchquery does not work for https URLs.

Update of _security gives a CouchdbException

When a normal update is done a response of 201 is given. However with Couchdb NOT in admin party when one tries to update the _security document it a response of 200 is generated when it is succesful. So everything works perfectly, but couchquery only accepts a 201 hence an exception is generated.

Testcase with credential and without

The variable at couch_httpd_auth -> require_valid_user determines whether the database is protected against password or not. By setting this to true, the tests will all fail as it requires credentials.

Adding credentials to the URI will pass the tests, but when I deactivate this variable to false, the test will fail again.

Need some kind of falllback measurement here.

Problem with changes

I use the changes module that you have added. This works OK if couchdb is in admin party mode. However, when I switch off the admin party mode, I get an error.

c =httplib.HTTPConnection(u.netloc)
t = c.request('GET',u.path)
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/httplib.py", line 973, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.7/httplib.py", line 1007, in _send_request
self.endheaders(body)
File "/usr/lib/python2.7/httplib.py", line 969, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 829, in _send_output
self.send(msg)
File "/usr/lib/python2.7/httplib.py", line 791, in send
self.connect()
File "/usr/lib/python2.7/httplib.py", line 772, in connect
self.timeout, self.source_address)
File "/usr/lib/python2.7/socket.py", line 553, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno -2] Name or service not known

I have tried the exact statements from the python console and I get this error (which is the error that is produced by the script) So obviously something is going wrong there, but I have no idea what is going on. Could you take a look?

views in python

Currently views supported are written in JS. which is default for CouchDB. It might be a good feature to have view also written in python.

sync_design_doc fail with credentials

tests/test_document.py:43:

self = <couchquery.Views object at 0x28a8b90>, name = 'banzai'

def __getattr__(self, name):
    if debugging:
        response = self.db.http.head(self.path+name+'/')
    if not debugging or response.status == 200:
        setattr(self, name, Design(self.db, '_design/'+name))
        return getattr(self, name)
    else:
      raise AttributeError("No view named "+name)

E AttributeError: No view named banzai

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.