On Sun, Jun 5, 2011 at 8:55 PM, Gnarlodious <gnarlodi...@gmail.com> wrote: > 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 -- http://rebertia.com -- http://mail.python.org/mailman/listinfo/python-list