Mercurial > code > home > repos > href
diff lookup.py @ 38:f3a15a724483
mongo api and up-checking
author | drewp@bigasterisk.com |
---|---|
date | Sat, 19 Nov 2022 17:05:15 -0800 |
parents | 76f379c99317 |
children | c538dc39b851 |
line wrap: on
line diff
--- a/lookup.py Sat Nov 19 17:03:17 2022 -0800 +++ b/lookup.py Sat Nov 19 17:05:15 2022 -0800 @@ -24,8 +24,9 @@ from jadestache import Renderer from link import Links, NotFound from pagetitle import PageTitle - -db = pymongo.MongoClient(os.environ['MONGODB_SERVICE_HOST'], tz_aware=True)['href'] +from mongo_required import open_mongo_or_die, die_on_mongo_connection_errors +from get_agent import bottleGetAgent +db = open_mongo_or_die()['href'] pageTitle = PageTitle(db) links = Links(db) renderer = Renderer(search_dirs=['template'], debug=bottle.DEBUG) @@ -193,6 +194,7 @@ @bottle.route('/<user>/<tags>') +@die_on_mongo_connection_errors() def userLinks(user, tags): tags = parseTags(tags) log.info('userLinks user=%r tags=%r', user, tags)