mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Wat da fuke pytz
This commit is contained in:
parent
78f37782ae
commit
3a3ce804d6
2 changed files with 5 additions and 2 deletions
|
@ -7,7 +7,6 @@ import locale
|
||||||
import logging
|
import logging
|
||||||
from argparse import SUPPRESS
|
from argparse import SUPPRESS
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
import pytz
|
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
|
|
||||||
import argcomplete
|
import argcomplete
|
||||||
|
@ -103,6 +102,8 @@ def pretty_date(_date):
|
||||||
Argument:
|
Argument:
|
||||||
- date -- The date or datetime to display
|
- date -- The date or datetime to display
|
||||||
"""
|
"""
|
||||||
|
import pytz # Lazy loading, this takes like 3+ sec on a RPi2 ?!
|
||||||
|
|
||||||
# Deduce system timezone
|
# Deduce system timezone
|
||||||
nowutc = datetime.now(tz=pytz.utc)
|
nowutc = datetime.now(tz=pytz.utc)
|
||||||
nowtz = datetime.now()
|
nowtz = datetime.now()
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import logging
|
import logging
|
||||||
from json.encoder import JSONEncoder
|
from json.encoder import JSONEncoder
|
||||||
import datetime
|
import datetime
|
||||||
import pytz
|
|
||||||
|
|
||||||
logger = logging.getLogger("moulinette.utils.serialize")
|
logger = logging.getLogger("moulinette.utils.serialize")
|
||||||
|
|
||||||
|
@ -23,6 +22,9 @@ class JSONExtendedEncoder(JSONEncoder):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def default(self, o):
|
def default(self, o):
|
||||||
|
|
||||||
|
import pytz # Lazy loading, this takes like 3+ sec on a RPi2 ?!
|
||||||
|
|
||||||
"""Return a serializable object"""
|
"""Return a serializable object"""
|
||||||
# Convert compatible containers into list
|
# Convert compatible containers into list
|
||||||
if isinstance(o, set) or (hasattr(o, "__iter__") and hasattr(o, "next")):
|
if isinstance(o, set) or (hasattr(o, "__iter__") and hasattr(o, "next")):
|
||||||
|
|
Loading…
Add table
Reference in a new issue