Hi,

I'm going to write an alternative implementation of
zope.app.file.interfaces.IFile . This implementation will automatically
determine the mime type of the data it's containing.

I would like to add a method that determines (guesses), if the current file
object contains an image...

 isimage=(mimetype(self.data).split('/')[0] == 'image')

... and I want to dynamically make the object implement another interface ...

 if isimage:
    IImage.provide(self)
 else:
    IImage.dontprovide(self)

Unfortunately, there is no 'provide' method on interfaces :-( .

Now the questions:

1. Is the list of a content object's provided interfaces stored persistently
   in the Zodb?
   
2. Is it according to Zope-, Python-, ... philosophy ok to danymically implement
   interfaces depending on the inner state of an object?
 
3. How do I manually make objects provide or "unprovide" given interfaces?

Regards,

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

Reply via email to