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


Python Message.subject方法代码示例

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


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

示例1: post

# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import subject [as 别名]
 def post(self):
   text = cgi.escape(self.request.get('text'))
   sender = cgi.escape(self.request.get('sender'))
   recipient = cgi.escape(self.request.get('recipient'))
   subject = cgi.escape(self.request.get('subject'))
   parent_message = cgi.escape(self.request.get('parent'))
   q = User.query(User.username == recipient)
   user = q.get()
   if(user):
     if len(parent_message) > 0:
       message_key = ndb.Key(urlsafe=parent_message)
       message = Message(parent = message_key)
     else:
       message = Message()
     message.subject = subject
     message.text = text
     message.sender = sender
     message.recipient = recipient
     message.time = datetime.datetime.now() - datetime.timedelta(hours=7) #For PST
     message.put()
     #Increment message count for navbar
     q = User.query(User.username == recipient)
     user = q.get()
     user.message_count += 1
     user.put()
     self.redirect('/messages')
   else:
     self.redirect('/compose')
开发者ID:tungply7,项目名称:Tutoring-Service,代码行数:30,代码来源:Messages.py

示例2: message_out

# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import subject [as 别名]
def message_out():
#    login.logout_user()
    org_form = SelectOrgForm(Orgs=build_orgs())
    print build_orgs().choices[0]
    message_form = MessageForm(Choices=build_users(build_orgs().choices[0][1]))
    save_org = build_orgs().choices[0][1]
    if request.method == 'POST':
        if request.form['btn']=="select":
            print "select"
            d_choices = dict(build_orgs().choices)
            print d_choices[org_form.org.data]
            save_org = d_choices[org_form.org.data]
            message_form = MessageForm(Choices=build_users(d_choices[org_form.org.data]))
        else:
            print "send"
            print save_org
            if save_org is None:
                print "None"
            else:
                d2_choices = dict(build_users(save_org).choices)
                print d2_choices[message_form.name_to.data]
            message = Message()
            message.addr = d2_choices[message_form.name_to.data]
            message.subject = str(message_form.subject.data)
            message.message = str(message_form.content.data)
            message.save()
            flash("Message Sent", category='success')
#    message_form = MessageForm()
    return render_template('forum/org_list.html' ,form=org_form, message_form=message_form)
开发者ID:sheng01,项目名称:DuluthKids.Net,代码行数:31,代码来源:views.py

示例3: process_messages

# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import subject [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

示例4: create_message

# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import subject [as 别名]
def create_message(email_message):
    if email_message:
        message = Message()
        message.subject = email_message.subject
        message.sent_date = email_message.sent_date
        message.message_id = email_message.message_id
        message.thread_id = email_message.thread_id  # where should this logic live?
开发者ID:thechild,项目名称:mbox2sql,代码行数:9,代码来源:importing.py


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