Browse files

Stop using deprecated Connection class

Connection has been deprecated for the benefit of MongoClient. Updating
this module to use it instead.

ref: http://api.mongodb.org/python/current/api/pymongo/connection.html
  • Loading branch information...
1 parent 0279fa4 commit a1410d5fc0313b76ae109dcc95f8de25925ff84e @ferrix ferrix committed Mar 7, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 tastypie_mongodb/resources.py
View
6 tastypie_mongodb/resources.py
@@ -1,5 +1,5 @@
from bson import ObjectId
-from pymongo import Connection
+from pymongo import MongoClient
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse
@@ -9,7 +9,7 @@
from tastypie.resources import Resource
-db = Connection(
+db = MongoClient(
host=getattr(settings, "MONGODB_HOST", None),
port=getattr(settings, "MONGODB_PORT", None)
)[settings.MONGODB_DATABASE]
@@ -87,4 +87,4 @@ def get_resource_uri(self, item):
return reverse("api_dispatch_detail", kwargs={
"resource_name": self._meta.resource_name,
"pk": pk
- })
+ })

0 comments on commit a1410d5

Please sign in to comment.