当前位置: 首页>>代码示例>>Python>>正文


Python Message.send方法代码示例

本文整理汇总了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})
开发者ID:viorels,项目名称:udacity-messages,代码行数:14,代码来源:messages-app.py

示例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()
开发者ID:ghinch,项目名称:Mail-Engine,代码行数:21,代码来源:workers.py

示例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})
开发者ID:viorels,项目名称:udacity-messages,代码行数:25,代码来源:messages-app.py

示例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')
开发者ID:viorels,项目名称:udacity-messages,代码行数:7,代码来源:tests.py

示例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)
开发者ID:MagicSolutions,项目名称:django-labyrinpy,代码行数:7,代码来源:tests.py

示例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)
开发者ID:MagicSolutions,项目名称:django-labyrinpy,代码行数:5,代码来源:tests.py

示例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)
开发者ID:MagicSolutions,项目名称:django-labyrinpy,代码行数:7,代码来源:tests.py


注:本文中的models.Message.send方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。