On 5/29/06, Frank Burkhardt <[EMAIL PROTECTED]> wrote:
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('/') == 'image')
... and I want to dynamically make the object implement another interface ...
Ehhh. Really? I must say that I find that a very suspiscious way of
handling that problem. Rather I would use a factory that generates the
correct type of object (image or file) from the data.
Unfortunately, there is no 'provide' method on interfaces :-( .
Of course, you don't want to make an interface dynamically be another
interface, that just doens't make any sense. You could probably do it
by making the OBJECT provide different interfaces dynamically.
2. Is it according to Zope-, Python-, ... philosophy ok to danymically implement
interfaces depending on the inner state of an object?
Uhm. IMO, no, not unless you really, really have to.
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
Zope3-users mailing list