[Zope-dev] zope-tests - FAILED: 5, OK: 12

Marius Gedminas marius at gedmin.as
Mon Sep 16 16:38:03 CEST 2013


On Mon, Sep 16, 2013 at 01:50:32PM +0300, Marius Gedminas wrote:
> On Mon, Sep 16, 2013 at 01:00:01AM +0200, Zope tests summarizer wrote:
> > [5]    winbot / zope.testbrowser_py_265_32
> 
> Interesting new error:
...
> At first I suspected Windows line endings, but look closer:
> 
>     - Content-type: text/csv
>     + Content-type: application/octet-stream

    rdesktop winbot.zope.org
    "Git Bash"
    $ /c/python26_32/python
    >>> import mimetypes
    >>> mimetypes.guess_type('x.csv')
    (None, None)

So that's fun.

The test in question does

    >>> browser.getControl(name='foo').add_file(
    ...     b'blah blah blah', 'text/csv', 'x.csv')

and then we get to the implementation of .add_file(), which has this
nice little XXX comment

         # XXX: webtest relies on mimetypes.guess_type to get mime type of
         # upload file and doesn't let to set it explicitly, so we are ignoring
         # content_type parameter here. If it is still unacceptable, consider
         # using mock.object to force mimetypes to return "right" type.
         self._form[self.name] = webtest.forms.Upload(filename or '', contents)

and then ignores the content_type argument.

First of all, monkey-patch?  Instead of fixing the problem upstream?
Seriously?

Therefore https://github.com/Pylons/webtest/issues/86

Marius Gedminas
-- 
http://pov.lt/ -- Zope 3/BlueBream consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://mail.zope.org/pipermail/zope-dev/attachments/20130916/b9010510/attachment.sig>


More information about the Zope-Dev mailing list