[EMAIL PROTECTED] wrote:
> I'm trying to allow Zope3 Images in my IBlog container
> 
> I've tried many variations of the follwoing without success.
> 
> 
> interfaces.py
> 
> class IBloggable(Interface):
>     """ Marker interface"""
> 
> 
> myclass.py
> 
> class ImageBlogAdapter(object):
> 
>     implements(IBloggable)
> 
>     __name__ = __parent__ = None
> 
>     def __init__(self, context):
>         self.context = context
> 
> 
> configure.zcml
> 
>     <adapter
>             for="zope.app.file.interfaces.IImage"
>               factory=".myclass.ImageBlogAdapter"
>             provides=".interfaces.IBloggable"
>             />

I don't know how the container constraint works - i.e. whether it tries
to adapt a __setitem__ object.

But just in case you're not aware you can implement your marker
interface on the Image class via zcml..

    <!-- Allow Images to be added to a blog -->

    <class class="zope.app.file.Image">
        <implements interface=".interfaces.IBloggable" />
    </class>

<
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to