Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #7069

Re: CGI: remove variable from Tuple Object query

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <chris@rebertia.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:query': 0.07; 'url:py': 0.07; 'attribute': 0.09; 'instance.': 0.09; 'iterate': 0.09; 'subject:remove': 0.09; 'tuple': 0.09; 'pm,': 0.10; 'this:': 0.10; 'skip:[ 20': 0.12; 'wrote:': 0.14; 'function;': 0.16; 'object?': 0.16; 'subject:variable': 0.16; 'type:': 0.16; 'url:hg': 0.16; 'cc:addr:python-list': 0.17; 'cheers,': 0.19; 'header:In-Reply-To:1': 0.21; 'variable': 0.21; 'modify': 0.22; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'reason,': 0.23; 'received:209.85.213.46': 0.23; 'received:mail- yw0-f46.google.com': 0.23; 'appear': 0.23; 'object': 0.26; 'message-id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.30; 'none,': 0.30; 'sun,': 0.30; 'equivalent': 0.31; "skip:' 10": 0.32; 'relatively': 0.32; 'does': 0.33; 'url:default': 0.33; 'external': 0.33; 'chris': 0.34; 'however,': 0.34; 'there': 0.35; 'source,': 0.35; 'stuck': 0.35; 'using': 0.35; 'received:google.com': 0.37; 'received:209.85': 0.37; 'query': 0.37; 'received:209.85.213': 0.37; 'url:python': 0.38; 'subject:from': 0.38; 'url:org': 0.38; 'subject:: ': 0.38; 'should': 0.39; 'received:209': 0.39; 'url:cgi': 0.65; 'url:0': 0.69; 'as:': 0.71; 'url:ip addr': 0.74; 'parts,': 0.84; 'sender:addr:chris': 0.84; 'url:lib': 0.84; 'url:7': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=qiUYzol9sS+VWMqzs/NK18y9aHmJ/AR65VeqoZ59pFs=; b=BjYl/jAgi97G+aDTmYt8G5yKHNSHvtbv358fPavOYeG8lKF2ngNKCIgnoncuQ2nA83 HTNi9xAeRxY9jvZSLPDpllAQtCyPTIY+G2XUVHDrJNzpTgTlH7AFsC1jI7cH8wb0LKKk ElqI/2e5r6W58Z2zg3+dcl8kUqO3jcFen382o=
DomainKey-Signature a=rsa-sha1; c=nofws; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=LXEwdNGVEfM+eUFSYtLpFPipKMOqT/BSClFbiQGpEmYaP7Cu9c1yirURtcoGpp+A1P qADw6uaijNU5fh5kuyPr4CxRL/QyEd+Cw8KzfWo+Zy1QuSkOZU3OvMcbHBg8iY6ABRAq 4xxMlH/CSu3Kj7Dw3vFY9yvAe3MTrdd/RNe0Q=
MIME-Version 1.0
Sender chris@rebertia.com
In-Reply-To <efa25bc5-a115-4c4f-869e-91eb423d0754@j23g2000yqc.googlegroups.com>
References <efa25bc5-a115-4c4f-869e-91eb423d0754@j23g2000yqc.googlegroups.com>
Date Sun, 5 Jun 2011 21:26:24 -0700
X-Google-Sender-Auth Cf-45LglJJaeybsHfsnCBYwy-5Q
Subject Re: CGI: remove variable from Tuple Object query
From Chris Rebert <clp2@rebertia.com>
To Gnarlodious <gnarlodious@gmail.com>
Content-Type text/plain; charset=UTF-8
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2481.1307334392.9059.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 82.94.164.166
X-Trace 1307334392 news.xs4all.nl 49176 [::ffff:82.94.164.166]:54152
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7069

Show key headers only | View raw


On Sun, Jun 5, 2011 at 8:55 PM, Gnarlodious <gnarlodious@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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

CGI: remove variable from Tuple Object query Gnarlodious <gnarlodious@gmail.com> - 2011-06-05 20:55 -0700
  Re: CGI: remove variable from Tuple Object query Chris Rebert <clp2@rebertia.com> - 2011-06-05 21:26 -0700

csiph-web