本文整理汇总了Python中models.Message.send方法的典型用法代码示例。如果您正苦于以下问题:Python Message.send方法的具体用法?Python Message.send怎么用?Python Message.send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Message
的用法示例。
在下文中一共展示了Message.send方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import send [as 别名]
def get(self):
user = users.get_current_user()
for i in range(1, 4):
Message.send(from_user=user, to_user=user,
subject="message %d" % i,
content="content %d" % i)
UserProfile.for_user(user).update_groups(['python'])
for group in ('all', 'python'):
GroupMessage.send(from_user=user, to_group=group,
subject="group message for %s" % group,
content="hello users of group %s" % group)
self.render('home.html', {'setup': True})
示例2: post
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import send [as 别名]
def post(self):
settings = Settings.get_by_key_name(config.SETTINGS_KEY)
sender = self.request.get(SENDER, settings.default_sender)
subject = self.request.get(SUBJECT, settings.default_subject)
body = self.request.get(BODY, '')
recipients = self.request.get(RECIPIENTS)
if recipients:
recipients = recipients.split(COMMA)
else:
recipients = []
m = Message(recipients=recipients,
sender=sender,
subject=subject,
body=body)
m.put()
m.send()
示例3: post
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import send [as 别名]
def post(self):
# TODO: users.is_current_user_admin() ? can he send a group message ?
to = self.request.get('to')
subject = self.request.get('subject')
content = self.request.get('content')
from_user = users.get_current_user()
if self.is_valid_group(to):
group = to
GroupMessage.send(from_user=from_user,
to_group=group,
subject=subject,
content=content)
else: # assume 'to' is an email
to_user = users.User(to)
Message.send(from_user=from_user,
to_user=to_user,
subject=subject,
content=content)
self.render('compose.html', {'sent': True,
'subject': subject,
'to': to})
示例4: _sendMessage
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import send [as 别名]
def _sendMessage(self):
Message.send(from_user=self.user1,
to_user=self.user2,
subject='subject',
content='content')
示例5: test_send_sms_no_optional
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import send [as 别名]
def test_send_sms_no_optional(self):
messages_before = Message.objects.count()
Message.send(**self.no_optional)
messages_after = Message.objects.count()
self.assertTrue(messages_after > messages_before)
示例6: test_for_invalid_sms
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import send [as 别名]
def test_for_invalid_sms(self):
with self.assertRaises(TypeError):
Message.send(**self.invalid_sms)
示例7: test_send_sms
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import send [as 别名]
def test_send_sms(self):
messages_before = Message.objects.count()
Message.send(**self.query_string)
messages_after = Message.objects.count()
self.assertTrue(messages_after > messages_before)