本文整理汇总了Python中helpers.Helpers.getTimeToText方法的典型用法代码示例。如果您正苦于以下问题:Python Helpers.getTimeToText方法的具体用法?Python Helpers.getTimeToText怎么用?Python Helpers.getTimeToText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers.Helpers
的用法示例。
在下文中一共展示了Helpers.getTimeToText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from helpers import Helpers [as 别名]
# 或者: from helpers.Helpers import getTimeToText [as 别名]
class Main:
bDebug = False
bLog = False
oServices = ''
oErrorHandler = ''
oHelpers = ''
def __init__(self):
self.oErrorHandler = ErrorHandler()
self.oHelpers = Helpers()
def run(self):
"""Check services for all servers configs data"""
if self.validateServicesList():
self.oServices = Services() #Create Services object
for info in services.services_list:
self.oServices.check(info)
# show debug
self.showDebugResult()
# save logs
self.saveLogFile()
def validateServicesList(self):
"""Validate if the services list not empty"""
bResult=True
if len(services.services_list) == 0:
print self.oErrorHandler.displayError('cod-003', 'warning')
bResult=False
return bResult
def showDebugResult(self):
""" Show debug, first show Error, then Ok results"""
if self.bDebug == True:
for x in self.oServices.listDebugResultError:
print x
for x in self.oServices.listDebugResultOk:
print x
def saveLogFile(self):
"""Save result in log file"""
if self.bLog:
try:
fileLog = open('logs/log_'+self.oHelpers.getTimeToFileName(), 'w')
fileLog.seek(0)
fileLog.write("Fecha y Hora: "+self.oHelpers.getTimeToText()+"\r\n \r\n");
for result in self.oServices.listTextResultError:
fileLog.write(result)
for result in self.oServices.listTextResultOk:
fileLog.write(result)
fileLog.close()
except IOError:
print self.oErrorHandler.displayError('cod-005')
def showHelp(self):
""" Read the help file to show help's script"""
try:
sHelp = open('docs/help', 'r').read()
print sHelp
except:
print self.oErrorHandler.displayError('cod-004')