Giter VIP home page Giter VIP logo

zope.mimetype's Introduction

zope.mimetype

Latest release Supported Python versions https://coveralls.io/repos/github/zopefoundation/zope.mimetype/badge.svg?branch=master Documentation Status

This package provides a way to work with MIME content types. There are several interfaces defined here, many of which are used primarily to look things up based on different bits of information.

See complete documentation at https://zopemimetype.readthedocs.io/en/latest/

zope.mimetype's People

Contributors

agroszer avatar baijum avatar benji-york avatar dataflake avatar dhavlik avatar faassen avatar freddrake avatar hannosch avatar icemac avatar jamadden avatar janwijbrand avatar jugmac00 avatar menesis avatar mgedmin avatar strichter avatar tseaver avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

jean nextthought

zope.mimetype's Issues

Inconsistent interface resolution order

InconsistentResolutionOrderError: For object <InterfaceClass zope.mimetype.interfaces.IContentTypeSource>.
Base ROs:
{<InterfaceClass zope.schema.interfaces.IIterableSource>: [<InterfaceClass zope.schema.interfaces.IIterableSource>,
                                                           <InterfaceClass zope.schema.interfaces.ISource>,
                                                           <InterfaceClass zope.interface.Interface>],
 <InterfaceClass zope.schema.interfaces.ISource>: [<InterfaceClass zope.schema.interfaces.ISource>,
                                                   <InterfaceClass zope.interface.Interface>]}
Conflict Location:
[[<InterfaceClass zope.schema.interfaces.ISource>,
  <InterfaceClass zope.interface.Interface>],
 [<InterfaceClass zope.schema.interfaces.IIterableSource>,
  <InterfaceClass zope.schema.interfaces.ISource>,
  <InterfaceClass zope.interface.Interface>],
 [<InterfaceClass zope.schema.interfaces.ISource>,
  <InterfaceClass zope.schema.interfaces.IIterableSource>]]

If that's fixed, then running a third-party test suite that imports zope.mimetype and sets ZOPE_INTERFACE_STRICT_IRO passes.

`TypeError: startswith first arg must be bytes` in smartMimeTypeGuesser on Python 3

>>> from zope.mimetype.typegetter import smartMimeTypeGuesser
>>> smartMimeTypeGuesser(data=b'I am bytes', content_type='text/html')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jmadden/Projects/VirtualEnvs/zope.file34/lib/python3.4/site-packages/zope/mimetype/typegetter.py", line 77, in smartMimeTypeGuesser
    if data.startswith(prefix):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str

When the guessed mime type is 'text/html', then the smartMimeTypeGuesser wants to look through _xml_prefix_table to see if this might actually be XHTML. But the (static) _xml_prefix_table contains text strings on Python 3, so you get this TypeError. (There's another table that probably has the same issue for HTML).

Encountered in zope.file, a zope.formlib application:

 File "//zope.file34/lib/python3.4/site-packages/zope/publisher/publish.py", line 115, in debug_call
        return obj(*args)
 File "//zope.file34/lib/python3.4/site-packages/zope/formlib/form.py", line 868, in __call__
        self.update()
 File "//zope.file34/lib/python3.4/site-packages/zope/formlib/form.py", line 849, in update
        result = action.success(data)
 File "//zope.file34/lib/python3.4/site-packages/zope/formlib/form.py", line 640, in success
        return self.success_handler(self.form, self, data)
 File "//zope.file34/lib/python3.4/site-packages/zope/formlib/form.py", line 970, in handle_add
        self.createAndAdd(data)
 File "//zope.file34/lib/python3.4/site-packages/zope/formlib/form.py", line 975, in createAndAdd
        ob = self.create(data)
 File "//zope.file/src/zope/file/upload.py", line 70, in create
        updateBlob(ob, f)
 File "//zope.file/src/zope/file/upload.py", line 151, in updateBlob
        name=nameFinder(f))
 File "/zope.file34/lib/python3.4/site-packages/zope/mimetype/typegetter.py", line 77, in smartMimeTypeGuesser
        if data.startswith(prefix):
 TypeError: startswith first arg must be bytes or a tuple of bytes, not str

DeprecationWarning: IObjectEvent is deprecated.

zope/mimetype/interfaces.py:119: DeprecationWarning: IObjectEvent is deprecated. Import from zope.interface.interfaces
  class IContentTypeChangedEvent(zope.component.interfaces.IObjectEvent):

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.