Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PyMongo usage #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion professor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class SessionFlask(SessionMixin, Flask): pass

import pymongo
dbname = app.config.get('MONGODB_CONFIG', {}).pop('db', 'professor')
conn = pymongo.Connection(**app.config.get('MONGODB_CONFIG', {}))
conn = pymongo.MongoClient(**app.config.get('MONGODB_CONFIG', {}))
db = conn[dbname]

app.session_store = MongoSessionStore(db.session)
Expand Down
2 changes: 2 additions & 0 deletions professor/skeleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
__all__ = ('skeleton', 'sanitize')

from bson.binary import Binary
from bson.int64 import Int64
from bson.code import Code
from bson.dbref import DBRef
from bson.errors import InvalidDocument
Expand All @@ -36,6 +37,7 @@

BSON_TYPES = set([
int,
Int64,
long,
str,
unicode,
Expand Down
6 changes: 2 additions & 4 deletions professor/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,9 @@ def connect_to(database):
else:
host = database['hostname']
port = 27017
conn = pymongo.Connection(
conn = pymongo.MongoClient(
host=host,
port=port,
network_timeout=2,
slaveok=True,
port=port
)
conndb = conn[database['dbname']]

Expand Down