HTMLBuilder and <A HREF='script.py?foo=bar&ding=bats'>yeah teah</A>

Vespe Savikko vespe at cs.tut.fi
Thu Mar 9 10:33:34 EST 2000


Also sprach Ben Skelton <skeltobc at mailandnews.com>:

  Adrian Eyre wrote:
  > 
  > > b.startElement ('a', {'href': 'script.py?foo=bar&ding=bats'})
  > >
  > > [snip]
  > >
  > > <HTML><A HREF="script.py?foo=bar&ding=bats">Press me</A></HTML>
  > >
  > > note the '&' in the href argument.
  > 
  > Indeed. It's substituted for the ampersand, being illegal in an HTML
  > document.
  > 
  > > How can I do this properly?
  > 
  > What do you mean by properly?
  
  
  I want to pass arguments to the script.py. I thought the way to do this
  was
  via the url
  http://server/cgi-bin/script.py?argument1=value1&argument2=value2
  ie an ampersand separated list of argument=value.
  
  The idea is that when different hyperlinks are followed unique sets of
  arguments can be passed to the script.
  
Have you tried that? If your browser isn't broken it should decode the
HTML-encoded character entities when following the link. In other
words _in the HTML document_ the following links behave identically
(meaning they generate identical HTTP requests):

<a href="http://server/script?arg1=143&arg2=foo">Link</a>
<a href="http://server/script?arg1=143&arg2=foo">Link</a>

If I remember correctly the latter line is even more valid HTML since
it escapes the "dangerous" & character. 

  ++Vespe

-- 
  ------------------------------------------------------------------
       Vespe Savikko     vespe at cs.tut.fi     - to doom de doomsday -



More information about the Python-list mailing list