Example #1
0
    def test_set_item(self):

        user = backend.add_user('user02','*****@*****.**','pass02')
        post1 = backend.add_post('title01',user['id'],content='content01')

        item = backend.add_item('item1',user['id'],post1['id'],'')

        item = backend.set_item(item['id'],{'title':'title3'})
        assert item['title'] ==  'title3'
Example #2
0
    def test_set_item(self):

        user = backend.add_user('user02', '*****@*****.**', 'pass02')
        post1 = backend.add_post('title01', user['id'], content='content01')

        item = backend.add_item('item1', user['id'], post1['id'], '')

        item = backend.set_item(item['id'], {'title': 'title3'})
        assert item['title'] == 'title3'
Example #3
0
def item_add(post_id):

    form = ItemForm()
    if form.validate_on_submit():
        title = form.title.data.encode("utf-8")
        author_id = g.user_id
        atype = ""
        content = form.content.data
        try:
            item = backend.add_item(title, author_id, post_id, atype, content=content)
        except BackendError, ex:
            flash("新内容添加失败请重试", "error")
Example #4
0
def item_add(post_id):

    form = ItemForm()
    if form.validate_on_submit():
        title = form.title.data.encode('utf-8')
        author_id = g.user_id
        atype = ''
        content = form.content.data
        try:
            item = backend.add_item(title,
                                    author_id,
                                    post_id,
                                    atype,
                                    content=content)
        except BackendError, ex:
            flash('新内容添加失败请重试', 'error')