comparison sat/tools/utils.py @ 3879:46930301f0c1

tools: renamed module `sat.tools.datetime` to `date.tools.xmpp_datetime` to avoid conflict with Python's standard lib
author Goffi <goffi@goffi.org>
date Wed, 31 Aug 2022 13:18:56 +0200
parents 32087d7c25d4
children 022ae35a9d82
comparison
equal deleted inserted replaced
3878:32087d7c25d4 3879:46930301f0c1
32 import asyncio 32 import asyncio
33 from twisted.python import procutils, failure 33 from twisted.python import procutils, failure
34 from twisted.internet import defer 34 from twisted.internet import defer
35 from sat.core.constants import Const as C 35 from sat.core.constants import Const as C
36 from sat.core.log import getLogger 36 from sat.core.log import getLogger
37 from sat.tools.datetime import format_date, format_datetime 37 from sat.tools import xmpp_datetime
38 38
39 log = getLogger(__name__) 39 log = getLogger(__name__)
40 40
41 41
42 NO_REPOS_DATA = "repository data unknown" 42 NO_REPOS_DATA = "repository data unknown"
155 dtime = datetime.datetime.fromtimestamp( 155 dtime = datetime.datetime.fromtimestamp(
156 time.time() if timestamp is None else timestamp, 156 time.time() if timestamp is None else timestamp,
157 datetime.timezone.utc 157 datetime.timezone.utc
158 ) 158 )
159 159
160 return format_datetime(dtime) if with_time else format_date(dtime.date()) 160 return (
161 xmpp_datetime.format_datetime(dtime) if with_time
162 else xmpp_datetime.format_date(dtime.date())
163 )
161 164
162 165
163 def generatePassword(vocabulary=None, size=20): 166 def generatePassword(vocabulary=None, size=20):
164 """Generate a password with random characters. 167 """Generate a password with random characters.
165 168