[Twisted-web] Re: empty strings in request.args.items()

Jean-Paul Calderone exarkun at divmod.com
Sat Jul 12 17:10:21 EDT 2008

On Fri, 11 Jul 2008 14:20:48 -0500, DJ <d.a.abernathy at gmail.com> wrote:
>Hello All,
>I am a twisted novice using the request.args.items() method to write the
>data from a form to a web page.
>The problem is that the list values are returned with extra empty strings.
>I have included a copy of the request string and the dictionary below:
>*Here is the request string:*
>request <GET
>*Here are the values in request.args.items():*
>{'retryinterval': ['john', ''], 'datefmt': ['mark'], 'args': [''],
>'protocol': [
>'', ''], 'adaptername': ['', ''], 'keys': ['test', '', ''], 'format': [''],
>dapter': ['', ''], 'propagate': [''], 'handlers': ['', ''], 'path': ['',
>''], 'f
>ormatter': [''], 'qualname': [''], 'class': [''], 'adaptertype': ['', ''],
>l': ['', '', 'nathan']}
>An extra single quote empty string is appended to some of the lists in the
>dictionary, those extra empty strings should not be there.
>(ex: retryinterval should be -> 'retryinterval': ['john'] ; but instead it
>is -> 'retryinterval': ['john', ''] )
>Do you know of trick or a work around to correct this ?

They're not extra, they're taken from the query arguments.  If you know
that they aren't important, then you can just ignore them in your code,
or you can try to change the client so that it doesn't include them when
it makes the request.


More information about the Twisted-web mailing list