[Zope3-Users] adaptation/containers question
Tom Dossis
td at yoma.com.au
Thu Nov 9 19:49:24 EST 2006
ksmith93940-dev at yahoo.com 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>
<
More information about the Zope3-users
mailing list