monitoring/ffmap/dbtools.py
Dominik Heidler c34246f3a8 Let MongoClient be tz_aware
- output datetime objects from mongodb are now tz_aware with tzinfo=utc
- fixes #11
2016-02-15 18:51:40 +01:00

16 lines
267 B
Python

#!/usr/bin/python3
from pymongo import MongoClient
class FreifunkDB(object):
client = None
db = None
@classmethod
def handle(cls):
if not cls.client:
cls.client = MongoClient(tz_aware=True)
if not cls.db:
cls.db = cls.client.freifunk
return cls.db