本文整理汇总了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()