Entry 3071

qqtest

   

Submitted by anonymous on Jan. 22, 2010 at 10:24 p.m.
Language: Python. Code size: 1.0 KB.

def show(request,counter):
    if request.method == "GET":
        pasta = Paste.get_by_id(int(counter))
        if pasta == None:
            return HttpResponseNotFound()
        st = pasta.content.split("\n")
        out = ""
        counter = 1
        for line in st:
            out += "<p id='out'>"+ str(counter) +".   " + line +"</p>"
            counter +=1
        time = str(pasta.created.hour) + ":" + str(pasta.created.minute) + " "
        form = EditForm()
        form.fields['content'].initial = pasta.content
        form.fields['lang'].initial = pasta.language
        return render_to_response("show.html",
                              {"count":counter,
                               "user":pasta.author,
                               "code":out,
                               "lang":pasta.language,
                               "time": time + str(pasta.created.date()),
                               "form": form
                               })
    return HttpResponseForbidden("Only GET method!")

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).