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


Python Message.body方法代码示例

本文整理汇总了Python中models.Message.body方法的典型用法代码示例。如果您正苦于以下问题:Python Message.body方法的具体用法?Python Message.body怎么用?Python Message.body使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Message的用法示例。


在下文中一共展示了Message.body方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: process_messages

# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import body [as 别名]
def process_messages(limit):
    count = 0
    date_parser = dateutil.parser.parser()
    omsgs = OriginalMessage.objects()
    if limit:
        omsgs = omsgs.limit(limit)
    for raw_count, om in enumerate(omsgs):
        m = Message()
        m.body = om.body
        m.subFolder = om.subFolder
        m.filename = om.filename
        m.headers = om.headers
        m.subject = om.get_subject()
        m.date = date_parser.parse(om.get_date())
        m.to = [x for x in om.get_to() if "enron.com" in x]
        if not m.to:
            # Skip if none of the "To's" are to enron employees
            continue
        m.from_str = om.get_from()
        if "enron.com" not in m.from_str:
            # Skip if this email was not from an enron employee
            continue
        try:
            m.save()
        except Exception, e:
            print "Error trying to save: %s" % (m)
            print e
        count+=1
        if count % 5000 == 0:
            print "Processing %s raw messages, filtered to %s" % (raw_count, count)
开发者ID:jwmatthews,项目名称:BumptUp,代码行数:32,代码来源:reformat_data.py

示例2: forgotpassword

# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import body [as 别名]
def forgotpassword():

    if request.method == 'POST' and request.form['username']:
        try:
            userp = User.select().where(User.username==request.form['username']).get()
            user = User(
                username=request.form['username'],
                email=request.form['email'],
                password=userp.password
            )
            msg = Message("Naucilus Support",
                  sender="[email protected]",
                  recipients=[user.email])
            msg.body = "Hello, " + user.username + "! Your password is: " + userp.password  
            mail = Mail(app)
            mail.send(msg)
            return redirect(url_for('index'))


        except User.DoesNotExist:
            flash('That username does not exist')
    
    return render_template('forgotpassword.html')
开发者ID:Jovan3211,项目名称:naucilus,代码行数:25,代码来源:views.py


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