Exemplo n.º 1
0
                    return [1, '您不是该小组成员']
                AF_Object.update_time = datetime.datetime.now()
                group.topic_list.pull(AF_Object._id)
                group.topic_list.push(AF_Object._id)
            except Exception, e:
                logging.error(traceback.format_exc())
                logging.error('%s not exist, id %s' % (father_type, father_id))
                return [1, '该话题不存在!']
        elif father_type == "group-feedback":
            return [1, '不支持当前操作!']
        else:
            return [1, '完善中!']
    # create comment and save it
    ref_comments_list = str_to_int_list(ref_comments)
    #print ref_comments_list
    AF_Comment = Comment()
    AF_Comment.author = user
    AF_Comment.set_propertys(**{
        'body': body,
        'father': AF_Object,
        'ref_comments': ref_comments_list
    })

    if father_type != 'blog':
        AF_Comment.set_propertys(**{'group_id': AF_Object.group_id})
    # post to the AF_Object
    AF_Object.comment_list.push(AF_Comment._id)
    # post notification

    to_blog_author_mes = format_notification(note_from=user,
                                             note_to_what=AF_Object,
Exemplo n.º 2
0
#!/usr/bin/env python

from article.blog import Blog
from article.about import About
from article.comment import Comment
from article.reference import Reference
from article.tableform import Tableform
from article.langcode import Langcode

from tornado.escape import xhtml_unescape

blogs_all = [Blog(each) for each in Blog.datatype.find()]
comments_all = [Comment(each) for each in Comment.datatype.find()]
about_all = About.find()
ref_all = Reference.find()
table_all = Tableform.find()
code_all = Langcode.find()

for each in blogs_all + comments_all + about_all:
    each.abstract = xhtml_unescape(each.abstract)
    each.body = xhtml_unescape(each.body)

for each in ref_all:
    each.body = xhtml_unescape(each.body)

for each in code_all:
    each.code = xhtml_unescape(each.code)

for each in table_all:
    each.tableform = xhtml_unescape(each.tableform)