You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
etesync-server/django_etebase/admin-cli/management/commands/_utils.py

15 lines
404 B

from distutils.util import strtobool
from datetime import datetime
import pytz
def argbool(arg):
if arg == None: return None
return bool(strtobool(arg))
def argdate(arg):
if arg == None: return None
try:
return pytz.utc.localize(datetime.strptime(arg, '%Y-%m-%d %H:%M:%S'))
except ValueError:
return pytz.utc.localize(datetime.strptime(arg, '%Y-%m-%d %H:%M:%S.%f'))