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?

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

Marius Gedminas
http://pov.lt/ -- Zope 3/BlueBream consulting and development

Attachment: signature.asc
Description: Digital signature

Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to