python cgi save data

Discussion in 'Programming' started by mitchw, Jul 22, 2008.

  1. #1
    hi all

    im writing a cgi script in python and i need to save a list of tuples (containing strings) so that it may be sent to other scripts once the user submits these forms. I tried to use a hidden field because it is simple to work with, however the field will contain both double and single quote characters which then leads to any other info to get cut off.

    eg the list will be saved by python like this: [('hello', "the weather's nice today", 'yay'), ("g'day", 'foo', 'dog')]

    but if i then go <hidden value="[('hello', "the weather's nice today", 'yay'), ("g'day", 'foo', 'dog')]">

    the browser only sees value="[('hello', "the weather's nice today"

    im hoping there is another way to save this data without using a hidden field, but i havnt found it yet. any help would be greatly appreciated.
     
    mitchw, Jul 22, 2008 IP
  2. mitchw

    mitchw Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    ps. im using the post method.
    pps. i would prefer not to use cookies if it can be avoided
    :)
     
    mitchw, Jul 22, 2008 IP
  3. mr_chase

    mr_chase Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    is it possible that it fails when you're using double quotes(") inside another double quote?
    try like this (only single quotes inside double quote).
    <hidden value="[('hello', 'the weather's nice today', 'yay'), ('gday', 'foo', 'dog')]">
     
    mr_chase, Sep 12, 2008 IP