Giter Site home page Giter Site logo

couchdb-python's Introduction

couchdb-python's People

Contributors

djc avatar cmlenz avatar atomatt avatar janl avatar kxepal avatar tilgovi avatar daevaorn avatar jaberg avatar tsipinio avatar amoore avatar chadwhitacre avatar dorins avatar dustin avatar gourneau avatar jab avatar ryanolson avatar

couchdb-python's Issues

error handling raises exceptions

Receiving an exception from CouchDB 0.7.0a575 causes an exception like this:

  File "/home/jpa/Projects/couchdb/couchdb-python/couchdb/client.py", line
517, in _request
    error = data.get('error', {}).get('reason', data)
AttributeError: 'unicode' object has no attribute 'get'

The attached patch fixes this issue. 

Original issue reported on code.google.com by [email protected] on 13 Nov 2007 at 12:20

Attachments:

Download URL for development version needed for easy_install

Hello,

I need to make CouchDB-FUSE depend on CouchDB >= 0.5dev-r125, but at the
moment easy_install can't find a development version of couchdb-python to
download.  I believe the solution is as easy as providing a link to the SVN
repository, with something like "#egg=CouchDB-0.5dev" appended to it.

If this could be added it would make installing the current version of
CouchDB-FUSE a lot easier.

Thanks,

Jason

Original issue reported on code.google.com by [email protected] on 27 Nov 2008 at 8:54

Missing import

couchdb/client.py Line 65

Client attempts to write to sys.stdout without importing sys.

Original issue reported on code.google.com by [email protected] on 2 Jun 2008 at 3:43

[maybe bug?] Bulk update does not execute unless return value is iterated

def update(self, documents):
    documents = list(documents)
    data = self.resource.post('_bulk_docs', content=documents)
    for idx, result in enumerate(data['results']):
        assert 'ok' in result # FIXME: how should error handling work here?
        doc = documents[idx]
        doc.update({'_id': result['id'], '_rev': result['rev']})
        yield doc

This won't perform the POST until the first result is asked for. I'm not
sure if this is a bug or intentional as iterating the result has other side
effects too.  It just seemed a bit spooky and confused me for a while.

If iterating is optional, I think something like the following would 
make sure the update is always called when the function is called while
preserving the current usage.

def update(self, documents):
        documents = list(documents)
        data = self.resource.post('_bulk_docs', content=documents)
        def foo():
            for idx, result in enumerate(data['results']):
                assert 'ok' in result # FIXME: how should error handling
work here?
                doc = documents[idx]
                doc.update({'_id': result['id'], '_rev': result['rev']})
                yield doc
        return foo()

Original issue reported on code.google.com by [email protected] on 6 Feb 2008 at 10:36

Add log() function to view server

What steps will reproduce the problem?
1. place a call to log() inside python view code

What is the expected output? What do you see instead?
Expected: log output in the couchdb log.
Instead: Error output from the view server

Please use labels and text to provide additional information.

Possible Solution:
Inject a log() function into the locals dictionary when evaluating view code.

See http://wiki.apache.org/couchdb/ViewServer for what should be outputted
back to CouchDB by the log() function.

Original issue reported on code.google.com by [email protected] on 15 Jul 2008 at 3:55

Using Database.__setitem__ with JSON string bug

#test.py
import couchdb
server = couchdb.Server("http://localhost:5984")
db = server.create('test')
db['doc'] = '{ "foo": "bar" }'

#causes:
Traceback (most recent call last):
  File "test.py", line 4, in <module>
    db['doc'] = '{ "foo": "bar" }'
  File "build/bdist.linux-x86_64/egg/couchdb/client.py", line 264, in
__setitem__
AttributeError: 'str' object has no attribute 'update'

It would appear that Database.__setitem__ assumes that the passed document
is a dict object.

Attached a trivial patch.

Original issue reported on code.google.com by [email protected] on 4 Jul 2008 at 1:18

Attachments:

'unicode' object is not callable

My model:

import couchdb.client as couch
import couchdb.schema as couch
import datetime as datetime

class Foo(couch.Document):
    ip = couch.TextField()
    lastPolled = couch.DateTimeField(default = datetime.datetime.now())


My code:
node = Foo.Foo(ip = '67.202.38.207')
node.store(db)
return node.id()

I get the following exception:
TypeError: 'unicode' object is not callable

Any ideas?

Original issue reported on code.google.com by [email protected] on 1 Jan 2008 at 2:04

__setitem__ in client.Database

in __setitem__ in client.Database:

def __setitem__(self, id, content)

if 'content' has attributes '_rev' and '_id', perhaps it could do an update
instead of assuming its new?


Original issue reported on code.google.com by [email protected] on 20 Aug 2008 at 2:19

Database.update does not pass its doctests

What steps will reproduce the problem?
1. Do the doctests in client.py:333
2. It will fails miserably
3.

What is the expected output? What do you see instead?
Expected:
<Document u'...'@u'...' {'type': 'Person', 'name': 'John Doe'}>
<Document u'...'@u'...' {'type': 'Person', 'name': 'Mary Jane'}>
<Document u'...'@u'...' {'type': 'City', 'name': 'Gotham City'}>
Instead:
(500, (u'EXIT', u'{{badmatch,{{obj,[{"type","Person"},{"name","John
Doe"}]},\n            {obj,[{"type","Person"},{"name","Mary Jane"}]},\n   
        {obj,[{"type","City"},{"name","Gotham City"}]}}},\n
[{couch_httpd,handle_db_request,3},\n  {couch_httpd,handle_request,2},\n 
{mochiweb_http,headers,4},\n  {proc_lib,init_p,5}]}'))


What version of the product are you using? On what operating system?
0.8.0

Please provide any additional information below.

Maybe it's a server problem

Original issue reported on code.google.com by [email protected] on 26 Jun 2008 at 2:20

Calling len() on a ViewResult raises an Exception

I call a named view and then check the number of results by calling len().

I receive the following traceback:

  if len(result) == 0:
  File "build/bdist.linux-i686/egg/couchdb/client.py", line 722, in __len__
    return len(self.rows)
  File "build/bdist.linux-i686/egg/couchdb/client.py", line 733, in _get_rows
    self._fetch()
  File "build/bdist.linux-i686/egg/couchdb/client.py", line 727, in _fetch
    for r in data['rows']]
TypeError: string indices must be integers

Original issue reported on code.google.com by [email protected] on 3 Nov 2008 at 6:09

Exception mapping view results to Object derived from schema.Document

What steps will reproduce the problem?
1. couchdb from source, svn Revision: 720997
2. couchdb-python from source, svn Revision: 130
3. python 2.6 on mac os x 10.5
4. run the att'd script: python break.py

Please provide any additional information below.

run the att'd script and you'll see that there's an exception thrown in mapping 
view results back to 
the User object that is derived from schema. 


Original issue reported on code.google.com by [email protected] on 29 Nov 2008 at 10:02

Attachments:

Rename one of the Document classes

It is a bit confusing that within couchdb-python there are two classes
named "Document", and it requires manual disambiguation in code. 

I'd suggest renaming the class in schema.py to something like "Model" which
is fairly common in mapping layers like this. Better to rename it sooner
before it breaks too much code.

Original issue reported on code.google.com by [email protected] on 11 Jun 2008 at 9:00

Failure when creating empty attachments

The following trace occurs when trying to create an empty attachment:

ERROR: test_empty_attachment (couchdb.tests.client.DatabaseTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jason/src/couchdb-python/couchdb/tests/client.py", line 89,
in test_empty_attachment
    self.db.put_attachment(doc, '', 'empty.txt')
  File "/home/jason/src/couchdb-python/couchdb/client.py", line 442, in
put_attachment
    }, rev=doc['_rev'])
  File "/home/jason/src/couchdb-python/couchdb/client.py", line 834, in put
    **params)
  File "/home/jason/src/couchdb-python/couchdb/client.py", line 860, in
_request
    resp, data = _make_request()
  File "/home/jason/src/couchdb-python/couchdb/client.py", line 855, in
_make_request
    body=body, headers=headers)
  File "build/bdist.linux-i686/egg/httplib2/__init__.py", line 1050, in request
  File "build/bdist.linux-i686/egg/httplib2/__init__.py", line 854, in _request
  File "build/bdist.linux-i686/egg/httplib2/__init__.py", line 824, in
_conn_request
  File "/usr/lib/python2.5/httplib.py", line 928, in getresponse
    response.begin()
  File "/usr/lib/python2.5/httplib.py", line 385, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.5/httplib.py", line 349, in _read_status
    raise BadStatusLine(line)
BadStatusLine

It seems that httplib doesn't send a Content-Length header when the content
body is ''.  The attached patch contains a test and also a one-line fix
that simply adds the Content-Length header.

Original issue reported on code.google.com by [email protected] on 25 Nov 2008 at 7:47

Attachments:

replication_helper doesn't handle create/delete

What steps will reproduce the problem?
1. configure couchdb to use replication_helper.py as update notifier
2. create a db in a 'slave' couchdb

What is the expected output? What do you see instead?
Expected would be the replication_helper to create the db on the target
server. Instead nothing happens.

What version of the product are you using? On what operating system?
CouchDB 0.9.0a706617-incubating
Linux dyc-ucbdesk 2.6.24-21-generic #1 SMP Mon Aug 25 16:57:51 UTC 2008
x86_64 GNU/Linux

Please provide any additional information below.

Original issue reported on code.google.com by ulises.cervino on 22 Oct 2008 at 1:23

Server should default to http://localhost:5984

What steps will reproduce the problem?
1. Quick bit of code
2. Think of all the keystrokes saved!
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?
0.8-incubating

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 9 Jul 2008 at 6:58

server[dbname] should return false if dbname doesn't exist

What steps will reproduce the problem?
1. create a couchdb server
2. try 'dbname in server', where dbname doesn't exist
3. throws a 500 error

What is the expected output? What do you see instead?

I expect 'False'

I see:

couchdb.client.ServerError: (500, (u'error', u'not_found'))




Original issue reported on code.google.com by [email protected] on 19 Aug 2008 at 12:44

How do I link the python view server to couchdb?

What steps will reproduce the problem?
1. try to run couchdb w/ python cod
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?
0.8-incubading

Please provide any additional information below.

I know I need to edit; /usr/local/etc/couchdb/couch.ini
and add a line to the [Couch Query Servers] section
But I'm unsure what that should be;

python=python -e couchdb "couchdb.run()"

Doesn't seem to work, but it may be because I'm not sure about the python
view syntax itself...


Original issue reported on code.google.com by [email protected] on 9 Jul 2008 at 8:36

db["index.html"] isn't happy

What steps will reproduce the problem?
1. Use the couchdb web interface to create a database
2. Create a document in the database called "index.html"
3. try to access it w/ the library

What is the expected output? What do you see instead?
I was trying to store the contents of an HTML file in a document entry
called index.html
May not be a legal couchdb action

What version of the product are you using? On what operating system?
couchdb - Apache CouchDB 0.8.0-incubating

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 14 Oct 2008 at 12:52

Feature request: allow subclasses of couchdb.schema.Document control over their couchdb ID (i.e. PUT not POST)

Currently subclasses of couchdb.schema.Document have to accept the CouchDB
id that's given to them; Document.store calles Database.create, which is
hard coded to POST to couchdb, meaning that couchdb generates an ID.

Need to have control over the ID e.g. if I define a property called id for
my subclass of Document, it's value is used to PUT to couchdb.

Original issue reported on code.google.com by [email protected] on 17 May 2008 at 8:54

JSON Module is not installed by default until Python 2.6

1. Install on a system with python less than 2.6 
2. >>> import couchdb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.5-i386/egg/couchdb/__init__.py", line 9, in
<module>
  File "build/bdist.macosx-10.5-i386/egg/couchdb/client.py", line 34, in
<module>
ImportError: No module named json



Original issue reported on code.google.com by [email protected] on 24 Dec 2008 at 9:31

Query metadata?

Right now, if you submit a query with "count=0", with either client.query
or client.view, you are unable to access the metadata for the results; both
functions make that data inaccessible.

To fix it, I added a meta() function to the View class and a viewmeta(self,
name, **options) function to the Database class.

I will submit a patch if you'd like; I'm not sure how you want to implement
this functionality.

Original issue reported on code.google.com by [email protected] on 7 Nov 2007 at 2:34

How do you iterate over the keys passed to a reduce?

What steps will reproduce the problem?
def reduce(keys,vals):
  return keys,vals

keys looks like: 
[["cool", "ff3d92f5dd4a82c942aad94010a0693f"], 
["cool", "052d904ebd898788dd46ea8e690c803e"]]

However, any attempt to access elements of keys by index fails. i.e.
keys[0] or keys[0][0]

What is the expected output? What do you see instead?
["cool", "ff3d92f5dd4a82c942aad94010a0693f"]
"cool"

Instead my reduce is failing silently.

What version of the product are you using? On what operating system?
couchdb-python 0.5
couchdb 0.9.0a735366-incubating

Please provide any additional information below.
def map(doc):
  if 'tags' in doc:
    for tag in doc['tags']:
      yield tag, 1

def reduce(keys,vals):
  tags = {}
  start = 0
  if rereduce:
    tags = vals[0]
    start = 1

  for i in range(start,len(keys)):
    tags[keys[i][0]] = tags[keys[i][0],0) + vals[i]

  return tags

Original issue reported on code.google.com by [email protected] on 20 Jan 2009 at 2:07

exit should be sys.exit (PATCH)

http://svn.debian.org/wsvn/python-modules/packages/python-couchdb/trunk/debian/p
atches/python-sys-exit.patch?op=file&rev=0&sc=1

Original issue reported on code.google.com by [email protected] on 13 Feb 2008 at 12:15

Setting the _id field is not passed on to the DB

Hello,
   Sorry if I'm missing something obvious, I only started playing with CouchDB yesterday, and it's been a long 
week... ;)


If I create a document object:

>>> dataset = client.Document()
>>> dataset['_id'] =  "/CSA07AllEvents/CMSSW_1_6_9-FastSim-1204301968/AOD"
>>> dataset['key'] = ["/CSA07AllEvents/CMSSW_1_6_9-FastSim-1204301968/AOD", 0]
>>> db.create(dataset)

I would expect that the _id of the object, once created in the db, would be the 
same as what I set it to. At the 
moment it is lost, and a new one auto generated. 

Likewise, if I do something like:

>>> doc = {
...     "_id": "the id I generate",
...     "key": ["the id I generate", 0]
... }
>>> db['thing'] = doc

the _id in the dictionary is over ridden by the db['thing'] (though I can 
understand that). 

I guess this would mean changing the Database.create() method, and given that's 
a short but sweet method 
maybe this isn't practical. Doing the db['id I want'] is fine, but I think it 
would be neater if this was wrapped up in 
the Document object (maybe it is and I'm missing something obvious...).


I ask because the application I'm evaluating using Couchdb (and it's python 
interface) for will have a lot of 
GUID's already in place, and I don't really want/need a new one.
Cheers
Simon

Original issue reported on code.google.com by [email protected] on 3 Dec 2008 at 6:26

Can't create a named document

What steps will reproduce the problem?
1.  db.create({'_id': 'hi', 'contents':'ho'})
u'f37d8d5594fa8dd9b0c4642269275343'
>>> db["hi"]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File
"/usr/lib/python2.5/site-packages/CouchDB-0.4-py2.5.egg/couchdb/client.py",
line 253, in __getitem__
  File
"/usr/lib/python2.5/site-packages/CouchDB-0.4-py2.5.egg/couchdb/client.py",
line 646, in get
  File
"/usr/lib/python2.5/site-packages/CouchDB-0.4-py2.5.egg/couchdb/client.py",
line 688, in _request
couchdb.client.ResourceNotFound: (u'not_found', u'missing')


What is the expected output? What do you see instead?
Personally (and tied w/ a previous comment) I'd expect to be able to create
documenta via;
db["new_doc"] = { 'contents': 'foo', 'bar' : True }
but I could understand if that needed to be;
db.create( '_id': "new_doc", 'contents': 'foo', 'bar' : True)

What version of the product are you using? On what operating system?
>>> couchdb.__version__
'0.4'


Please provide any additional information below.
BTW though I love the library! I'm not the code guy I'd like to be but it's
been helpful to actually be able to read your code (it's taught me about
couchdb's REST API and python too).

Thanks for the work!

Original issue reported on code.google.com by [email protected] on 14 Oct 2008 at 1:25

client.Document vs schema.Document

Hello,

This is not an issue but a question. I could not find a discussion group or
a mailing list, please direct me if this isn't the appropriate forum.

I'm trying to understand how to use client.Document and schema.Document
objects in couchdb-python. For my use I don't need to map JSON documents to
python objects. However, I'm finding it cumbersome to convert responses
from the database to schema.Document objects in order to have access to
general purpose methods such as load, store and items. The similar names
also complicates keeping track of the class of an object. 


Original issue reported on code.google.com by [email protected] on 4 Dec 2008 at 1:40

Server.__getitem__ does not raise ResourceNotFound when database does not exist.

What steps will reproduce the problem?
1. Create a couchdb server object 
>>> import couchdb
>>> s = couchdb.client.Server('http://localhost:5984/')

2. 'get' a database from the server which does not exist yet.
>>> db = s['foobar']

What is the expected output? What do you see instead?
Expect a ResourceNotFound exception. Instead a Database object is returned.

What version of the product are you using? On what operating system?
0.5, Ubuntu Linux 8.04

Please provide any additional information below.
Patch is attached below.

Original issue reported on code.google.com by [email protected] on 17 Dec 2008 at 7:26

Attachments:

Add required fields

It would be helpful to be able to programmatically add some constraints to
Couchdb data. The Python schema classes provide a nice place to do this.

Attached is a patch that adds an optional "required" parameter to fields.
When set to True, all instances must be created with a value for that field
(whether loaded from a database or created manually). When created manually
the initial value must be passed during construction. This also works with
default values as you would expect.

If this patch (or something like it) is accepted I'll also create a similar
patch that lets you specify an "options" parameter for fields that will
constrain values to only those values.

Original issue reported on code.google.com by [email protected] on 12 Jun 2008 at 3:43

Attachments:

Initializing document with empty dic fails

db['people'] = {}

returns:

[info] [<0.47.0>] HTTP Request: PUT /strigo-data/people HTTP/1.1
[info] [<0.47.0>] HTTP Error (code 500): {obj,[{error,"EXIT"},
                             {reason,"{function_clause,[{cjson,tokenize,\n
                        [[],{decoder,utf8,null,1,1,any}]},\n              
   {cjson,decode1,2},\n                  {cjson,json_decode,2},\n         
        {mod_couch,handle_doc_put,2},\n                 
{mod_couch,do,1},\n                  {httpd_response,traverse_modules,2},\n
                 {httpd_response,generate_and_send_response,1},\n         
        {httpd_request_handler,handle_response,1}]}"}]}
[info] [<0.47.0>] HTTP Response Code:500


---- solution ----

<jmoiron> line 628 in client.py
<jmoiron> it does "if content:", which is gonna be false on your empty dict
<mahound> yep
<jmoiron> it should be "if not content is None:"
<jmoiron> so yes it does end up doing an empty put
<jmoiron> which is bad
<jmoiron> you can post the bug and include that :)

Original issue reported on code.google.com by [email protected] on 15 Mar 2008 at 9:32

bulk get?

As a new couchdb-python user (I love it) how do I do a bulk get?  Is it 
possible to control the 
Database.view to POST instead of GET?

Original issue reported on code.google.com by [email protected] on 26 Nov 2008 at 11:12

validate_dbname does not enforce database names starting with characters

What steps will reproduce the problem?
1. Create a couchdb Server object
>>> import couchdb
>>> s = couchdb.client.Server('http://localhost:5984/')

2. Create a Database where the name doesn't start with a-z
>>> db = s['999']

What is the expected output? What do you see instead?
Should raise an exception that the database name is invalid, instead the
Database object is returned

What version of the product are you using? On what operating system?
Version 0.5. Ubuntu Linux 8.04

Please provide any additional information below.
Patch attached

Original issue reported on code.google.com by [email protected] on 17 Dec 2008 at 7:33

Attachments:

_fetch fails with map/reduce views (KeyError: 'id')

What steps will reproduce the problem?
1. create some documents
2. run a map/reduce view, like:
http://damienkatz.net/2008/02/incremental_map.html
3. try to print the rows

What is the expected output? What do you see instead?

# HTTP Response
{"rows":[{"key":"Batiste","value":1},{"key":"Yoan","value":2}]}

# traceback
Traceback (most recent call last):
  File "data.py", line 65, in <module>
    for message in messages:
  File "build/bdist.linux-i686/egg/couchdb/client.py", line 548, in __iter__
  File "build/bdist.linux-i686/egg/couchdb/client.py", line 567, in _get_rows
  File "build/bdist.linux-i686/egg/couchdb/client.py", line 561, in _fetch
KeyError: 'id'

What version of the product are you using? On what operating system?

couchdb-python: r71
couchdb: r663055

Please provide any additional information below.

I patched it very quickly but I assume that CouchDB API isn't finished at
this time.

Original issue reported on code.google.com by yoan.blanc on 5 Jun 2008 at 4:16

Attachments:

replication_helper should pull from source instead of pushing to each target

pull-based replication results is a faster, more efficient process because of 
request pipelining.  
Here's a patch:

--- a/couchdb/tools/replication_helper.py
+++ b/couchdb/tools/replication_helper.py
@@ -63,9 +63,9 @@ class ReplicationHelper(object):

         # send replication request to target server
         for target_server in self.args.target_servers: 
-            body['target'] = self.concat_uri(target_server, database)
+            body['target'] = database
             self.http.request(
-                self.concat_uri(self.args.source_server, '_replicate'), 
+                self.concat_uri(target_server, '_replicate'), 
                 'POST', 
                 body=json.dumps(body, ensure_ascii=False))


Original issue reported on code.google.com by [email protected] on 8 Jan 2009 at 7:16

FeatureRequest: Allow use of schema.Document objects for x_attachment operations

When using the put_attachment method, you can't use a schema.document
object directly, you need to requery the db for a document(list).  It would
be nice to be able to just use your schema.document object instead.

What is the expected output? What do you see instead?
foo = Foo(bar=1,baz=2)
foo.store(db)
db.put_attachment(foo,f,fName)


What version of the product are you using? On what operating system?
couchdb-python 0.5

Please provide any additional information below.
I've already implemented part of it -- the put_attachment modification. 
I'll supply a patch shortly

Original issue reported on code.google.com by [email protected] on 10 Jan 2009 at 10:48

can't get result from a "reduce"

What steps will reproduce the problem?
1. Make a view with a reduce function
2. Query it with Db.view function
3.

What is the expected output? What do you see instead?
KeyIndex 'id' exception is raised. Which is normal because a reduce view
don't provide id key, nor total_rows result.

What version of the product are you using? On what operating system?
latest trunk (0.8-incubing)

Please provide any additional information below.


Find here a quick patch that solve it.


Original issue reported on code.google.com by [email protected] on 20 Jun 2008 at 12:21

Attachments:

Creation of new DB is akward

What steps will reproduce the problem?
1. wrong way of going about it (although more intuitive for me)
def create_db(server, name):
       try:
            return server[name]
       except KeyError:
            return server.create(name)
2. right way (works):
def create_db(server, name):
    if name in server:
        return server[name]
    else:
        return server.create(name)

print create_db(server, 'test') outputs: <Database 'test'> in both cases
print [x for x in server] outputs all dbs but 'test' if using fn 1

Ideally I would expect the Exception KeyError to be raised by accessing the
server dict if the db didn't exist in the first implementation.

What version of the product are you using? On what operating system?
couchdb 0.8.1, svn couchdb-python

Original issue reported on code.google.com by ulises.cervino on 21 Sep 2008 at 11:23

ListFields can not be assigned to ListFields

Assigning one ListField instance to another converts the data from a json
compatible list to an AnonymousStruct Schema instance. Repro:

class Post(Model):
     title = TextField()
     content = TextField()
     pubdate = DateTimeField(default=datetime.now)
     comments = ListField(DictField(Schema.build(
         author = TextField(),
         content = TextField(),
         time = DateTimeField()
     )))

post = Post(title='Foo bar')
post.comments.append(author='myself', content='Bla bla',
                      time=datetime.now())
print post.comments
post.comments = post.comments
print post.comments

You should see that the second print of post.comments is wrong. This
happens because ListField._to_json does not correctly convert a Proxy to
json data.

One possible solution is attached. Very small patch, but it sure took me a
while to figure out given the nested nature of DictField and ListField.

Original issue reported on code.google.com by [email protected] on 12 Jun 2008 at 1:11

Attachments:

Timeout error - should it be handled by auto-retry stuff?

I get the following traceback occasionally.  I'm wondering whether this 
should be handled using the auto-retry stuff?

  File "/home/jason/django_projects/netspade/blog/model.py", line 32, in 
num_comments
    rows = list(db.view('_view/comments/count', group=True)[self.id])

  File "/usr/lib/python2.5/site-packages/CouchDB-0.5dev_r117-
py2.5.egg/couchdb/client.py", line 722, in __len__
    return len(self.rows)

  File "/usr/lib/python2.5/site-packages/CouchDB-0.5dev_r117-
py2.5.egg/couchdb/client.py", line 733, in _get_rows
    self._fetch()

  File "/usr/lib/python2.5/site-packages/CouchDB-0.5dev_r117-
py2.5.egg/couchdb/client.py", line 725, in _fetch
    data = self.view._exec(self.options)

  File "/usr/lib/python2.5/site-packages/CouchDB-0.5dev_r117-
py2.5.egg/couchdb/client.py", line 621, in _exec
    resp, data = self.resource.get(**self._encode_options(options))

  File "/usr/lib/python2.5/site-packages/CouchDB-0.5dev_r117-
py2.5.egg/couchdb/client.py", line 801, in get
    return self._request('GET', path, headers=headers, **params)

  File "/usr/lib/python2.5/site-packages/CouchDB-0.5dev_r117-
py2.5.egg/couchdb/client.py", line 836, in _request
    resp, data = _make_request()

  File "/usr/lib/python2.5/site-packages/CouchDB-0.5dev_r117-
py2.5.egg/couchdb/client.py", line 831, in _make_request
    body=body, headers=headers)

  File "/usr/lib/python2.5/site-packages/httplib2-0.4.0-
py2.5.egg/httplib2/__init__.py", line 1050, in request

  File "/usr/lib/python2.5/site-packages/httplib2-0.4.0-
py2.5.egg/httplib2/__init__.py", line 854, in _request

  File "/usr/lib/python2.5/site-packages/httplib2-0.4.0-
py2.5.egg/httplib2/__init__.py", line 824, in _conn_request

  File "/usr/lib/python2.5/httplib.py", line 928, in getresponse
    response.begin()

  File "/usr/lib/python2.5/httplib.py", line 385, in begin
    version, status, reason = self._read_status()

  File "/usr/lib/python2.5/httplib.py", line 343, in _read_status
    line = self.fp.readline()

  File "/usr/lib/python2.5/socket.py", line 372, in readline
    data = recv(1)

timeout: timed out

Original issue reported on code.google.com by [email protected] on 26 Oct 2008 at 9:39

Checking if a database is in a server shouldn't throw an exception

What steps will reproduce the problem?
1. server = couchdb.Server(url)
2. dbname = 'db-which-doesnt-exist'
3. dbname in server

What is the expected output? What do you see instead?

False

I see:

couchdb.client.ServerError: (500, (u'error', u'not_found'))

What version of the product are you using? On what operating system?

0.4

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 20 Oct 2008 at 5:11

Can't access resources with slashes in their names

Trying to access a document with a name like books/1 causes a GET request
like this:  GET /library/books/1 HTTP/1.1 . This is an error, because
documents can't have slashes in their names. On the other hand, if you try
to access books%2F1, the result requested resource is /library/books%252F1
, which isn't much better.

I changed the signature of the uri function to accept a flag that specifies
whether or not it should quote slashes and created two new wrapper
functions, id_uri (specifies that slashes must be quoted) and view_uri
(specifies that slashes mustn't be quoted.)

I'm attaching a patch against revision 44.

Original issue reported on code.google.com by [email protected] on 17 Nov 2007 at 3:23

Attachments:

View with startkey as array and descending=true

I have a view that has a key of form [campaign_id, date].  When I call the
view like this, it yields results:

db.view('inbounds/by_campaign', startkey=[campaign_id, ''])


However, when I call this, it does not:

db.view('inbounds/by_campaign', startkey=[campaign_id, ''], descending=True)


Original issue reported on code.google.com by [email protected] on 22 Dec 2008 at 4:56

compact?

Would it be possible to add a client.Database.compact() method?  Apologies if 
there's already a 
solution for this that I missed.

Original issue reported on code.google.com by [email protected] on 29 Nov 2008 at 8:40

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.