def init_app(self, app): try: # FIXME: dumb double initialisation of the # driver because Eve sets it to None in __init__ self.driver = db self.driver.app = app self.driver.init_app(app) except Exception as e: raise ConnectionException(e)
def init_app(self, app): """ .. versionchanged:: 0.0.9 support for Python 3.3. """ # mongod must be running or this will raise an exception try: self.driver = PyMongo(app) except Exception as e: raise ConnectionException(e)
def pymongo(self, resource=None, prefix=None): """ Returns an active PyMongo instance. If 'prefix' is defined then it has precedence over the endpoint ('resource') and/or 'self.mongo_instance'. :param resource: endpoint for which a PyMongo instance is requested. :param prefix: PyMongo instance key. This has precedence over both 'resource' and eventual `self.mongo_prefix'. .. versionadded:: 0.6 """ px = prefix if prefix else self.current_mongo_prefix(resource=resource) if px not in self.driver: # instantiate and add to cache self.driver[px] = PyMongo(self.app, px) # important, we don't want to preserve state between requests self.mongo_prefix = None try: return self.driver[px] except Exception as e: raise ConnectionException(e)
def init_app(self, app): # mongod must be running or this will raise an exception try: self.driver = PyMongo(app) except Exception, e: raise ConnectionException(e)
def init_app(self, app): try: self.driver = PyMongo(app, config_prefix='LEGAL_ARCHIVE') except Exception as e: raise ConnectionException(e)
def init_app(self, app): try: super().init_app(app) except Exception as e: raise ConnectionException(e)