4teamwork / ftw.zipexport

Zip Export for Plone
2 stars 6 forks source link

ImportError on INamedBlobFileField v2.0.2 #3

Closed shylux closed 11 years ago

shylux commented 11 years ago

@phgross @jone

Error resolved in newest version of plone.namedfile (not released yet).

Error occurs if z3c.blobfile is not available. https://github.com/plone/plone.namedfile/blob/1.0.x/plone/namedfile/interfaces.py#L9

How should we fix that?

jone commented 11 years ago

z3c.blobfile is not shipped with Plone but is often used with Plone. We should not have a dependency to z3c.blobfile, nor expect it to be there.

I thank what you need to do is a conditional import and not use the interface if blobs are not installed. Something like:

from plone.namedfile.interfaces import HAVE_BLOBS
if HAVE_BLOBS:
    from plone.namedfile.interfaces import INamedBlobFileField

...

if HAVE_BLOBS and INamedBlobFileField.providedBy ....:
  ...
shylux commented 11 years ago

Fixed in pull request #4 (78df05d).