Actually, you don't really even need to go back to the server for this
-- you can use Javascript to scramble/unscramble the strings. But
since this is clearly a CGI exercise, let's do it that way.

The database stuff is completely separate from showing anything in the
textareas. What you want is more like:

def GET(self):
    i = web.input(enc_text="", dec_text="")
    print render.main(i.enc_text, i.dec_text)

def POST(self):
    i = web.input()
    # save or log the input here, if you want, see TFM
    enc_text = dec_text = ""
    if i.encdec == "encrypt": enc_text = rob.encrypt(i.dec); dec_text
= i.dec
    else: dec_text = rob.decrypt(i.enc); enc_text = i.enc
    web.seeother('/?enc_text=%s&dec_text=%s' %
tuple(map(urllib.escape, (enc_text, dec_text))))  # see py docs for
which url-escaping function to use

And in the template you'll have:
<textarea name="enc">$enc_text</textarea>

NB: The above code probably won't execute. Also, orange? Jesus.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to