incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Gonzalez <gonva...@gonvaled.com>
Subject Re: Doing put_attachment + get causes "socket.error: [Errno 104] Connection reset by peer"
Date Fri, 01 Mar 2013 15:10:35 GMT
Corrected test script, which was a bit buggy:

import couchdb

db = couchdb.Server('http://localhost:5984')['unittestdb_deleteme']
doc_id = 'delete-me'

def test1():
    content = "this is the attachment"
    doc = { '_id' : doc_id }
    try:
        db.put_attachment(doc, content, 'test-attachment', 'text/plain')
    except couchdb.http.ResourceConflict:
        try:
            new_doc = db[doc_id]
            new_doc.update(doc)
            doc = new_doc
        except Exception, e:
            print type(e), e
        try:
            db.put_attachment(doc, content, 'test-attachment', 'text/plain')
        except Exception, e:
            print type(e), e
    except Exception, e:
            print type(e), e

for cnt in xrange(100):
    print "Round %d" % (cnt)
    test1()

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message