コード例 #1
0
ファイル: meep_example_app.py プロジェクト: kienlebr/meep
    def del_message(self, environ, start_response):
        #print environ['wsgi.input']
        form = cgi.FieldStorage(fp=environ['wsgi.input'], environ=environ)

        #print form
        
        messages = meeplib.get_all_messages()

        s = "Yup"
        found = False
        for m in messages:
            if m.id == int(form['id'].value):
                if meeplib.get_curr_user() != m.author.username:
                    s= "Nope"
                    break
                if m.pID != "!":
                    meeplib.delete_reply(m)
                meeplib.delete_message(m)
                found = True
            if found == True:
                break
        
        start_response("200 OK", [('Content-type', 'text/html')])
        #s.append("<p><p><a href = '/m/list'>Return to Messages</a>")

        SaveMessages()

        return render_page('del_message.html', s = s)
コード例 #2
0
    def delete_message_action(self, environ, start_response):
        print environ['wsgi.input']
        form = cgi.FieldStorage(fp=environ['wsgi.input'], environ=environ)

        id = int(form['id'].value)
        print id, ' A'
        meeplib.delete_message(meeplib.get_message(id))
        meeplib.delete_reply(id)
        meeplib.saveMSG()
        meeplib.saveREPLY()
        headers = [('Content-type', 'text/html')]
        headers.append(('Location', '/'))
        start_response("302 Found", headers)
        return ["message deleted"]
コード例 #3
0
ファイル: meep_example_app.py プロジェクト: pfritschen/meep
    def delete_message_action(self, environ, start_response):
        print environ['wsgi.input']
        form = cgi.FieldStorage(fp=environ['wsgi.input'], environ=environ)

        id = int(form['id'].value)
        print id, ' A';
        meeplib.delete_message(meeplib.get_message(id))
        meeplib.delete_reply(id)
        meeplib.saveMSG()
        meeplib.saveREPLY()
        headers = [('Content-type', 'text/html')]
        headers.append(('Location', '/'))
        start_response("302 Found", headers)
        return ["message deleted"]
コード例 #4
0
    def delete_reply_action(self, environ, start_response):
        print environ['wsgi.input']
        form = cgi.FieldStorage(fp=environ['wsgi.input'], environ=environ)

        id_num = form['id_num'].value
        #print "form"
        #print (id,)
        id_number = int(id_num)
        
        meeplib.delete_reply(meeplib.get_reply(id_number))

        headers = [('Content-type', 'text/html')]
        headers.append(('Location', '/m/list'))
        start_response("302 Found", headers)
        return ["reply deleted"]