CGI: remove variable from Tuple Object query

G

Gnarlodious

Say I send a request like this:
http://0.0.0.0/Sectrum/Gnomon?see=Gnomon&order=7&epoch=1303541219

This makes for a CGIform of the CGI Tuple Object type:
FieldStorage(None, None, [MiniFieldStorage('see', 'Gnomon'),
MiniFieldStorage('order', '7'), MiniFieldStorage('epoch',
'1303541219.58')])

So the above query should end up as:
FieldStorage(None, None, [MiniFieldStorage('order', '7'),
MiniFieldStorage('epoch', '1303541219.58')])

Is there an easy way to remove the first variable from the object? Or
am I stuck with using urllib.parse.urlparse(query)?

-- Gnarlie
 
C

Chris Rebert

Say I send a request like this:
http://0.0.0.0/Sectrum/Gnomon?see=Gnomon&order=7&epoch=1303541219

This makes for a CGIform of the CGI Tuple Object type:
FieldStorage(None, None, [MiniFieldStorage('see', 'Gnomon'),
MiniFieldStorage('order', '7'), MiniFieldStorage('epoch',
'1303541219.58')])

So the above query should end up as:
FieldStorage(None, None, [MiniFieldStorage('order', '7'),
MiniFieldStorage('epoch', '1303541219.58')])

Is there an easy way to remove the first variable from the object?
Or am I stuck with using urllib.parse.urlparse(query)?

For whatever reason, FieldStorage does not appear to make provision
for item deletion. However, it should be easy to monkeypatch in a
__delitem__ method or write an equivalent external function; just
iterate through and modify the `list` attribute of the FieldStorage
instance. FieldStorage's source, particularly the non-parsing-related
parts, is relatively straightforward:
http://hg.python.org/cpython/file/default/Lib/cgi.py

Cheers,
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top