Re: Stupid Newbie Question Concerning CGI and Reading Forward Slashes



Hi Joey,
I am not sure but still I might mean something and give you some clues.
Just try to change / with double slash(//) or with backslash(\ or \\).
next option is read about os module it can give u some hints about how paths
should be written.
Hope These will help.


Quoting "Joey C." <joeyjwc@xxxxxxxxx>:

> Hi, I want to make a configuration script for something and it needs to
> read inputs from an HTML file. A couple of these inputs are textboxes
> that the user inputs a path in. For example:
> Your Home Directory:
> [/home/me/public_html/]
>
> So, I'm using Python to read these inputs and store them in a
> configuration file. However, I cannot get the CGI to read the forward
> slashes (/). It just leaves a blank area. So, for example:
> Input: /usr/bin/sendmail
> Reads: sendmail
>
> Input: /home/me/public_html/
> Reads: (Nothing.)
>
> params = cgi.FieldStorage()
>
> def writep(key, name):
> if params.has_key(key):
> fconfig.write(name + ": " + os.path.split(params[key].value)[1] +
> ";\n")
>
> ^ This is the function for handling a key that is read by the cgi. The
> "name" is the name that it stores the key under so the configuration
> file looks like:
> name: key;[Line Break]
>
> However, is there a way to get it to read the forward slashes? If
> there isn't do you suggest having the user use a different character
> and adding a function in the script to substitute a forward slash for
> that character?
>
> I tried looking for this for a long while, but maybe I didn't search
> enough. Thanks for all of your help and I'm sorry if this is a
> question that has been asked 15 million times.
>
> Joey C.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


--
Regards,
Jatinder Singh

? Everyone needs to be loved... especially when they do not deserve it.?
.



Relevant Pages

  • Stupid Newbie Question Concerning CGI and Reading Forward Slashes
    ... I want to make a configuration script for something and it needs to ... is there a way to get it to read the forward slashes? ... there isn't do you suggest having the user use a different character ...
    (comp.lang.python)
  • Re: Single most annoying episode of Friends
    ... Joey used to be a normal uneducated person, although a bit dim-witted, ... know what to do with this character except repeatedly accentuating his ... writers less bright than Sir Arthur Conan Doyle have been ... one moron and one crazy woman. ...
    (rec.arts.tv)
  • Re: Who are you missing most?
    ... I can understand why Kevin might not, both for character (small baby at ... But Joey? ... Tina and Cord have felt like missing pieces too, ...
    (rec.arts.tv.soaps.abc)
  • Re: Funeral guests I would like to see come back on a regular basis
    ... character and actor has a unique ability to light up the screen when ... NF is hands down The Ultimate Joey and given his career since ... leaving OLTL, there's no way there would ever be a permanent return ...
    (rec.arts.tv.soaps.abc)
  • Re: Funeral guests I would like to see come back on a regular basis
    ... character and actor has a unique ability to light up the screen when ... she's on...to me she represents part of the best of OLTL and one of the ... NF is hands down The Ultimate Joey and given his career since ... good actor he has become and I sure hope we get to see him in something in ...
    (rec.arts.tv.soaps.abc)