Skip to content
This repository has been archived by the owner on Mar 12, 2018. It is now read-only.

Commit

Permalink
Restore SimplePool usage as a bug in RestKit was fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
sirn committed Jul 22, 2010
1 parent 8294a9f commit 2b82854
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 4 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ but has a database instance associate to it::
author = couchdb.StringProperty()
content = couchdb.StringProperty()

The extension make use of two configuration variables, but only
The extension make use of three configuration variables, but only
``COUCHDB_DATABASE`` is required. The database will be created if it does
not already exists. The other configuration variable is ``COUCHDB_SERVER``,
which sets the server to connect to.
not already exists. Two other configuration variables are ``COUCHDB_SERVER``,
which sets the server to connect to, and ``COUCHDB_KEEPALIVE``, which sets
the least amount of connection that will be kept open.

Defining Views
--------------
Expand Down
7 changes: 6 additions & 1 deletion flaskext/couchdbkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import couchdbkit
from flask import current_app
from couchdbkit import Server
from restkit import SimplePool
from couchdbkit.loaders import FileSystemDocsLoader


Expand Down Expand Up @@ -40,9 +41,13 @@ class CouchDBKit(object):
def __init__(self, app):
app.config.setdefault('COUCHDB_SERVER', 'http://localhost:5984/')
app.config.setdefault('COUCHDB_DATABASE', None)
app.config.setdefault('COUCHDB_KEEPALIVE', 2)

pool = SimplePool(keepalive=app.config.get('COUCHDB_KEEPALIVE'))
server = Server(app.config.get('COUCHDB_SERVER'), pool_instance=pool)

self.app = app
self.server = Server(app.config.get('COUCHDB_SERVER'))
self.server = server

_include_couchdbkit(self)
self.init_db()
Expand Down

0 comments on commit 2b82854

Please sign in to comment.