Esempio n. 1
0
 def __init__(self, *args, **kwargs):
     # Specifying that it should run both the inits
     MongoKitConnection.__init__(self, *args, **kwargs)
     if 'user' in kwargs:
         del(kwargs['user'])
         del(kwargs['pass'])
     PymongoConnection.__init__(self, *args, **kwargs)
 def __init__(self, hosts):
     MockClientBase.__init__(self)
     MongoClient.__init__(
         self,
         hosts,
         replicaSet=MOCK_RS_NAME,
         _pool_class=MockPool)
Esempio n. 3
0
 def __init__(self):
     MongoClient.__init__(self)
     self.db = self.land_register
     self.unique_streets_collection = self.db.unique_streets
     self.complete_streets_collection = self.db.complete_streets
     self.profiles_collection = self.db.profiles
     self.error_log_collection = self.db.error_log
     self.last_insert_log = self.db.last_insert_log
 def __init__(self):
     MongoClient.__init__(self)
     self.db = self.land_register
     self.unique_streets_collection = self.db.unique_streets
     self.complete_streets_collection = self.db.complete_streets
     self.profiles_collection = self.db.profiles
     self.error_log_collection = self.db.error_log
     self.last_insert_log = self.db.last_insert_log
Esempio n. 5
0
    def __init__(
        self, standalones, members, mongoses, ismaster_hosts=None,
        *args, **kwargs
    ):
        MockClientBase.__init__(
            self, standalones, members, mongoses, ismaster_hosts)

        kwargs['_pool_class'] = my_partial(MockPool, self)
        MongoClient.__init__(self, *args, **kwargs)
Esempio n. 6
0
 def __init__(
         self,
         host=None,
         port=None,
         document_class=dict,
         tz_aware=None,
         connect=None,
         **kwargs):
     MongoClient.__init__(self, host=host, port=port, document_class=document_class,
                          tz_aware=tz_aware, connect=connect, **kwargs)
    def __init__(self,
                 standalones,
                 members,
                 mongoses,
                 ismaster_hosts=None,
                 *args,
                 **kwargs):
        MockClientBase.__init__(self, standalones, members, mongoses,
                                ismaster_hosts)

        kwargs['_pool_class'] = my_partial(MockPool, self)
        MongoClient.__init__(self, *args, **kwargs)
Esempio n. 8
0
File: mongo.py Progetto: wjid/vasp
    def __init__(self,
                 host='localhost',
                 port=27017,
                 database='ase',
                 collection='atoms',
                 user=None,
                 password=None):
        """
        user and password are currently unused.
        """
        MongoClient.__init__(self, host, port)

        self.db = self[database]
        if user is not None and password is not None:
            self.db.authenticate(user, password)

        self.collection = getattr(self.db, collection)
Esempio n. 9
0
    def __init__(self,
                 host='localhost',
                 port=27017,
                 database='ase',
                 collection='atoms',
                 user=None,
                 password=None):
        """
        user and password are currently unused.
        """
        MongoClient.__init__(self, host, port)

        self.db = self[database]
        if user is not None and password is not None:
            self.db.authenticate(user, password)

        self.collection = getattr(self.db, collection)
Esempio n. 10
0
 def __init__( *args, **kwargs ):
     MongoClient.__init__( *args, **kwargs )
     self = args[ 0 ]
     def myget( *args, **kwargs ):
         item = args[ 0 ].__getattr__( *args, **kwargs )
         print 'myget item:', item
         item.find = lambda *a, **kw: dumps( [ i for i in item.find( *a, **kw ) ] )
         return item
     def mygetdb( *args, **kwargs ):
         item = args[ 0 ].__getattr__( *args, **kwargs )
         print 'mygetdb item:', item
         for c in item.collection_names():
             item[ c ].__getattr__ = myget
         return item
     for db in self.database_names():
         self[ db ].__getattr__ = mygetdb
         print self[ db ][ 'foo' ]
         for c in self[ db ].collection_names():
             print self[ db ][ c ].find
             print self[ db ][ c ].find( {} )
Esempio n. 11
0
    def __init__(*args, **kwargs):
        MongoClient.__init__(*args, **kwargs)
        self = args[0]

        def myget(*args, **kwargs):
            item = args[0].__getattr__(*args, **kwargs)
            print 'myget item:', item
            item.find = lambda *a, **kw: dumps(
                [i for i in item.find(*a, **kw)])
            return item

        def mygetdb(*args, **kwargs):
            item = args[0].__getattr__(*args, **kwargs)
            print 'mygetdb item:', item
            for c in item.collection_names():
                item[c].__getattr__ = myget
            return item

        for db in self.database_names():
            self[db].__getattr__ = mygetdb
            print self[db]['foo']
            for c in self[db].collection_names():
                print self[db][c].find
                print self[db][c].find({})
Esempio n. 12
0
 def __init__(self, *args, **kwargs):
     # Specifying that it should run both the inits
     MongoKitConnection.__init__(self, *args, **kwargs)
     PymongoConnection.__init__(self, *args, **kwargs)
 def __init__(self, host=None, port=None):
     if host and port:
         MongoClient.__init__(self, host, port)
 def __init__(self, *args, **kwargs):
     # Specifying that it should run both the inits
     MongoKitConnection.__init__(self, *args, **kwargs)
     PymongoConnection.__init__(self, *args, **kwargs)
Esempio n. 15
0
                 host=None,
                 port=None,
                 document_class=dict,
                 tz_aware=None,
                 connect=None,
                 type_registry=None,
                 **kwargs):
        super(Client, self).__init__(host=host,
                                     port=port,
                                     document_class=document_class,
                                     tz_aware=tz_aware,
                                     connect=connect,
                                     type_registry=type_registry,
                                     **kwargs)

    def insert(self):
        pass

    def get(self):
        pass

    def update(self):
        pass

    def delete(self):
        pass


if __name__ == '__main__':
    clinet = MongoClient.__init__()