diff sat/tools/utils.py @ 2612:3e4e78de9cca

tools (date_utils): moved date_parse to common.date_utils, because it can be used in frontends
author Goffi <goffi@goffi.org>
date Thu, 21 Jun 2018 01:21:44 +0200
parents cb7bf936d8e8
children 56f94936df1e
line wrap: on
line diff
--- a/sat/tools/utils.py	Thu Jun 21 01:21:44 2018 +0200
+++ b/sat/tools/utils.py	Thu Jun 21 01:21:44 2018 +0200
@@ -25,10 +25,8 @@
 from sat.core.log import getLogger
 log = getLogger(__name__)
 import datetime
-from dateutil import parser as dateutil_parser
 from twisted.python import procutils
 import subprocess
-import calendar
 import time
 import sys
 import random
@@ -91,14 +89,6 @@
     template = u"{}T{}".format(template_date, template_time) if with_time else template_date
     return datetime.datetime.utcfromtimestamp(time.time() if timestamp is None else timestamp).strftime(template)
 
-def date_parse(value):
-    """Parse a date and return corresponding unix timestamp
-
-    @param value(unicode): date to parse, in any format supported by dateutil.parser
-    @return (int): timestamp
-    """
-    return calendar.timegm(dateutil_parser.parse(unicode(value)).utctimetuple())
-
 def generatePassword(vocabulary=None, size=20):
     """Generate a password with random characters.