Allow current_app.db('collections-name')
This mimics the use in Flamenco (current_flamenco.db('collection_name')), and makes calling code a bit nicer (db('coll') instead of db()['coll'])
This commit is contained in:
@@ -551,12 +551,14 @@ class PillarServer(Eve):
|
|||||||
|
|
||||||
pprint(links)
|
pprint(links)
|
||||||
|
|
||||||
def db(self):
|
def db(self, collection_name: str=None):
|
||||||
"""Returns the MongoDB database.
|
"""Returns the MongoDB database.
|
||||||
|
|
||||||
:rtype: flask_pymongo.PyMongo
|
:rtype: flask_pymongo.PyMongo
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if collection_name:
|
||||||
|
return self.data.driver.db[collection_name]
|
||||||
return self.data.driver.db
|
return self.data.driver.db
|
||||||
|
|
||||||
def extension_sidebar_links(self, project):
|
def extension_sidebar_links(self, project):
|
||||||
|
Reference in New Issue
Block a user