本文整理匯總了Python中goodcrypto.utils.log_file.LogFile.write方法的典型用法代碼示例。如果您正苦於以下問題:Python LogFile.write方法的具體用法?Python LogFile.write怎麽用?Python LogFile.write使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類goodcrypto.utils.log_file.LogFile
的用法示例。
在下文中一共展示了LogFile.write方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Main
# 需要導入模塊: from goodcrypto.utils.log_file import LogFile [as 別名]
# 或者: from goodcrypto.utils.log_file.LogFile import write [as 別名]
#.........這裏部分代碼省略.........
def validate_email(email, role):
if email is None:
raise ValidationError(i18n('No email address specified for {role}'.format(
role=role)))
try:
email_validator = EmailValidator()
email_validator(email)
except ValidationError as validation_error:
self.log_message('Bad {} email address in envelope: {}'.format(role, email))
raise ValidationError(i18n('Bad {role} email address in envelope: "{email}"'.format(
role=role, email=email)))
return email
self.log_message('sender: {}'.format(self.sender))
self.log_message('recipients: {}'.format(self.recipients))
result_ok = True
self.sender = validate_email(sender, 'sender')
for recipient in recipients:
self.recipients.append(validate_email(recipient, 'recipient'))
if Main.DEBUGGING:
self.log_message('sender: {}'.format(self.sender))
self.log_message('recipients: {}'.format(self.recipients))
return result_ok
def read_message_from_stdin(self):
'''
Read the message from stdin.
>>> from test.support import captured_stdin
>>> with captured_stdin() as stdin:
... bytes = stdin.write('hello')
... position = stdin.seek(0)
... m = Main()
... m.read_message_from_stdin()
... ''.join(m.in_message)
'hello'
'''
message = []
try:
"""
in_stream = codecs.getreader('utf-8')(sys.stdin)
done = False
while not done:
line = in_stream.readline()
self.log_message('{}'.format(line))
self.log_message('{}'.format(type(line)))
message.append(line)
"""
done = False
while not done:
try:
line = input()
message.append(line)
if Main.DEBUGGING:
self.log_message(line)
except UnicodeDecodeError:
pass
except EOFError:
pass
except Exception:
record_exception()