Ejemplo n.º 1
0
	def POST(self):
		i = web.input(del_post_array=[])

		for pid in i.del_post_array:
			if not model.delete_post(pid):
				raise web.seeother('/admin/admin-posts?message=delete post failed.')

		raise web.seeother('/admin/admin-posts?message=delete post done.')
    def GET(self, post_id):
        if session.user == 'admin':
            post_id = int(post_id)
            r = model.delete_post(post_id)
            if r:
                return web.redirect("/")
        else:
	    return render({'title': settings.SITE_NAME}).notauth()
 def GET(self, post_id):
     if session.user == 'admin':
         post_id = int(post_id)
         r = model.delete_post(post_id)
         if r:
             return web.redirect("/")
     else:
         return render({'title': settings.SITE_NAME}).notauth()
Ejemplo n.º 4
0
	def POST(self):
		i = web.input(del_page_array=[])

		# page is 'page' post_type post.
		for pid in del_page_array:
			if not model.delete_post(pid):
				pass

		raise web.seeother("/admin/page-admin")
Ejemplo n.º 5
0
def dash_delete_post():
    id = request.form.get('id')
    delete_post(id)
    return redirect(url_for('dash_posts'))
Ejemplo n.º 6
0
def delete_post(pid):
    if pid < 0 or pid >= model.post_len():
        return 'post not found'
    model.delete_post(pid)
    return str(pid)
Ejemplo n.º 7
0
 def POST(self,id):
     model.delete_post(int(id))
     raise web.seeother('/')
Ejemplo n.º 8
0
import model
"""
now its just in smoke test level.
"""

if __name__ == '__main__':
	#clear data
	for i in range(1,100):
		model.delete_post(i)
	for j in range(3, 100):
		model.delete_category(j)

	post_id = model.new_post(1, 'title', 'content', None, None, 'blog', 'open', 'published', None, None)
	assert(post_id)
	
	post = model.get_post(post_id)

	assert(post.author_id == 1 and post.title == 'title' and post.content == 'content' and post.excerpt== None and post.slug == None and post.post_type=='blog' and post.comment_status=='open' and post.post_status=='published')

	c = model.get_post_categories(post_id)
	assert(len(c) == 1 and c[0].name == 'uncategorized' and c[0].parent_id == 0 and c[0].id == 1 and c[0].description == '' and c[0].type=='post_category')
	
	# test tag. TODO.
	assert(model.update_post(post_id, author_id=2, title='new title', content='new content', comment_status='close', post_status='saved'))
	
	post = model.get_post(post_id)
	assert(post.author_id == 2 and post.title == 'new title' and post.content == 'new content' and post.excerpt== None and post.slug == None and post.post_type=='blog' and post.comment_status=='close' and post.post_status=='saved')
	
	assert(model.update_post(post_id, author_id=1, title='title', content='content', comment_status='open', post_status='published'))

	another_post_id = model.new_post(1, 'title', 'content', None, None, 'blog', 'open', 'published', None, None)
Ejemplo n.º 9
0
 def POST(self, blogid):
     model.delete_post(int(blogid))
     raise web.seeother("/")