'''

This module takes a list of collections to retrieve from the mongodb DATABASE_ADDRESS

Usage:

connection = EdXConnection('tracking', 'course_structure')
collection = connection.get_access_to_collection()
# collection now is a list of two elements, each element referring to the corresponding collection

'''

from pymongo import MongoClient

DATABASE_ADDRESS = "mongodb://localhost"
# Make sure to change name of database before running the reporting scripts
DATABASE_NAME = 'atoc185x'

class EdXConnection(object):
    
    def __init__(self,*collections):
        client = MongoClient(DATABASE_ADDRESS)
        db = client[DATABASE_NAME]
        self.collection = {collection : db[collection] for collection in collections}

    def get_access_to_collection(self):
        return self.collection

@@ -120,16 +120,28 @@
 nection(
+'atoc185x', 
 'trackin
@@ -398,110 +398,8 @@
 st%22%0A
-# Make sure to change name of database before running the reporting scripts%0ADATABASE_NAME = 'atoc185x'
 %0A%0Acl
@@ -452,16 +452,26 @@
 __(self,
+ db_name, 
 *collect
@@ -532,16 +532,21 @@
         
+self.
 db = cli
@@ -553,21 +553,15 @@
 ent%5B
-DATABASE_NAME
+db_name
 %5D%0A  
@@ -581,16 +581,17 @@
 llection
+s
  = %7Bcoll
@@ -708,17 +708,18 @@
  self.collection
+s
 %0A

Update base_edx to allow passing name of database as a parameter