Hi, I have a problem to understand why there are so much different object types in Zope and why you can't access more general categories of objects. I found that it is not logic. If Zope is based on objects, he has to group some objects in more general classes together, so you can access Folder, Documents, Scripts and Images. Folder and Image classes exist, but a class Document which is an super class for the types Files, XML Document, DTML Document, etc. does not exist, as well as a class Script which could be an super class for Python scripts, DTML Methode, etc. i understand that zope needs a precise type for each object, but why can i not access a more general categorie of objects? cheers, Isabelle Neunreither konsylo Messeler-Park-Strasse 74 64291 DARMSTADT Fon: 0 6150 866 196 Fax: 0 6150 866 197 email: in@konsylo.com
On Thu, 31 May 2001 15:22:57 +0200, "Neunreither, Isabelle" <Isabelle.Neunreither@Dresdner-Bank.com> wrote:
Folder and Image classes exist, but a class Document which is an super class for the types Files, XML Document, DTML Document, etc. does not exist, as well as a class Script which could be an super class for Python scripts, DTML Methode, etc.
Zope inherits python's policy of weakly typing. abstract interfaces are not implememted using superclasses as they are in other (strongly typed) languages. Rather, as long as an object behave like a script (by providing attributes that are characteristic of scripts) then it can be considered to implement the script interface. Note that python may develop something more formal in this direction, and I am sure Zope will be able to make good use of it.
i understand that zope needs a precise type for each object, but why can i not access a more general categorie of objects?
You need to decide which attributes are characteristic of scripts (whatever that means to you) and test for their presence. Toby Dickenson tdickenson@geminidataloggers.com
I have a problem to understand why there are so much different object types in Zope and why you can't access more general categories of objects. I found that it is not logic. If Zope is based on objects, he has to group some objects in more general classes together, so you can access Folder, Documents, Scripts and Images. Folder and Image classes exist, but a class Document which is an super class for the types Files, XML Document, DTML Document, etc. does not exist, as well as a class Script which could be an super class for Python scripts, DTML Methode, etc. i understand that zope needs a precise type for each object, but why can i not access a more general categorie of objects?
Hi Isabelle! Zope is using "mix-in" classes, or in other words, Python multiple inheritance, so most objects are built from a toolkit of basic objects. E.g. this is from Image.py, which defines the image and file objects: import Globals, string, struct, content_types from OFS.content_types import guess_content_type from Globals import DTMLFile, MessageDialog from PropertyManager import PropertyManager from AccessControl.Role import RoleManager from webdav.common import rfc1123_date from SimpleItem import Item_w__name__ from cStringIO import StringIO from Globals import Persistent from Acquisition import Implicit from DateTime import DateTime from Cache import Cacheable With these building blocks, mainly SimpleItem and PropertyManager, a Zope object can be built. Image is then just a subclass of File that implements the differences, e.g. a tab for displaying the image, the code for rendering it as an html "<img src ...>" string etc.: "class Image(File)" So the concept of base classes is certainly there, but maybe a bit different than you'd expect ... (the "Document" base class is more or less what "SimpleItem" does, and the reason why DTMLDocument (which is just DTMLMethod plus PropertyManager ("class DTMLDocument(PropertyManager, DTMLMethod)") is not inherited from something like "Document", which might be a base class for XMLDocument, is just that it doesn't seem to share enough code to make this necessary. If you dig into Zope's code, you'll see that some parts are not very nice style. But they work, and that's the most important thing ;-) Joachim
participants (3)
-
Joachim Werner -
Neunreither, Isabelle -
Toby Dickenson