Merge remote branch 'refs/remotes/gullydwarf-cfdv/is315'
[mediagoblin.git] / mediagoblin / db / util.py
index 56f22d7ea864038d6ec3585fa428b0ffe378b662..30615fcadcf272f4dd0a778f6416caec055f538f 100644 (file)
@@ -1,13 +1,20 @@
-import mongokit
-from pymongo import DESCENDING
-from mongokit import ObjectId
+# GNU MediaGoblin -- federated, autonomous media hosting
+# Copyright (C) 2011 Free Software Foundation, Inc
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-def connect_database(app_config):
-    """Connect to the main database, take config from app_config"""
-    port = app_config.get('db_port')
-    if port:
-        port = asint(port)
-    connection = mongokit.Connection(
-        app_config.get('db_host'), port)
-    return connection
+# Imports that other modules might use
+from pymongo import DESCENDING
+from mongokit import ObjectId