Esempio n. 1
0
	def POST(self, id):
		if session.get('logged_in', False):
			id = int(id)
			model.del_post(id)
			raise web.seeother('/')
		else:
			raise web.seeother('/login')
Esempio n. 2
0
 def POST(self, id):
     form = web.input()
     password = form.password
     if str(password) == '123':
         model.del_post(int(id))
         raise web.seeother('/')
     else:
         return render.base('You\'re Evil')
Esempio n. 3
0
 def POST(self, id):
     if not session.admin:
         authorization_error()
     post = model.get_post(int(id))
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     model.del_post(int(id))
     raise web.seeother('/')
Esempio n. 4
0
 def POST(self, id):
     if not session.admin:
         authorization_error()
     post = model.get_post(int(id))
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     model.del_post(int(id))
     raise web.seeother('/')
Esempio n. 5
0
 def POST(self, id):
     # 1. 删除静态资源照片
     post = model.get_post(int(id))
     photo_name = post.imageAddr.split('/')[-1]
     logger.debug('need delete photo path: ' + "/root/images/" + photo_name)
     try:
         os.remove("/root/images/" + photo_name)
     except Exception as e:
         logger.error(e)
     # 2. 删除表中记录
     model.del_post(int(id))
     #raise web.seeother("/")
     posts = model.get_posts()
     return render.index(posts)
Esempio n. 6
0
 def POST(self, id):
     model.del_post(int(id))
     raise web.seeother('/')
Esempio n. 7
0
 def GET(self, id):
     model.del_post(int(id))
     if web.cookies().get('username') == 'admin':
         raise web.seeother('/backstage')
     else:
         raise web.seeother('/')
Esempio n. 8
0
 def POST(self, id):
     model.del_post(int(id))
     raise web.seeother('/')
Esempio n. 9
0
 def GET(self,id):
     model.del_post(id)
     raise web.seeother('/')
Esempio n. 10
0
 def POST(self, id):
     thisPost = model.get_post(int(id))
     thisUser = auth.getUser()
     if thisPost.user_id == thisUser.user_id:
         model.del_post(int(id))
     raise web.seeother("/")
Esempio n. 11
0
 def POST(self, id):
     id_producto = int(id)
     model.del_post(id_producto)
     raise web.seeother('/')
Esempio n. 12
0
 def POST(self, post_id):
     model.del_post(post_id)
     raise web.seeother('/')