Hi Gang, I've created an external method manage_addMyZClass, basing my method off http://www.zope.org/Members/tazzzzz/addZClasses . However, whenever I call this external method on an ObjectManager derived ZClass, I get the error "Error Type: AttributeError; Error Value: this" on line 8, which just happens to be: self = self.this() I know that the this() call is needed so self equals the current context of the ObjectManager on which manage_addMyZClass is being called. Is there any other way to programmatically add a ZClass defined through the ZMI? And while I'm on that topic, what are the benefits/tradeoffs between using the ZMI to define products and using Python? I recently read the "A very minumal Product" How-To (http://www.zope.org/Members/maxm/HowTo/minimal_01), and noticed that this showed how write a manage_addMyZClass method in the context of a Python based product. The only reasons I've been given about defining products in the filesystems with Python vs. using the ZMI are being able to use external editors and CVS. Neither of these reasons are compelling enough for me, so why should else I use Python? I'm just starting a another Zope based site, and I have a slew of ZClasses to define. In the other (and first Zope based site) that I created and maintain I used only the ZMI to define ZClasses, so I'm pretty familiar with the process. Also, if I decide to go with Python based products, is there any easy way to turn a ZClass defined though the ZMI into a Python product? I'm not to worried about retyping code, but I've defined some fairly large propertysheets that would be annoying to recreate if I were to start from scratch. Thanks! -- Mark Adams mja27@cornell.edu "A man talking sense to himself is no madder than a man talking nonsense not to himself." - Rosencrantz and Guildenstern Are Dead
And while I'm on that topic, what are the benefits/tradeoffs between using the ZMI to define products and using Python?
Some of the main reasons to use Python-based products are - much better performance (ZClasses just "emulate" object behaviour; e.g. all sub-objects are actually just put into propertysheets) - being able to do much more things (e.g. calling Python libraries like the Python Imaging Library etc.) - avoiding problems with ZClasses (e.g. acquisition works not quite as advertised, multiple inheritance: base classes can only be defined at creation time and not changed later, inheritance does not work properly for propertysheets defined in ZClass-type base classes, ...)
Also, if I decide to go with Python based products, is there any easy way to turn a ZClass defined though the ZMI into a Python product? I'm not to worried about retyping code, but I've defined some fairly large propertysheets that would be annoying to recreate if I were to start from scratch.
It is not extremely hard to write a ZClass-to-Python code converter. But AFAIK there is no such beast yet. If you don't need the extra power Python gives you, you might be better off with them. Your programming will be magintudes faster using ZClasses (while the resulting code will be much slower ...), provided that you don't hit the limitations of ZClasses. We at iuveno are facing similar problems and are working at tools for making Zope product creation much easier. Most of it is not ready for use yet. But I'd ask you to tell me what you would expect from a "better Zope product definition framework" or whatever you'd call it. Just to give you an impression about our ideas, here are some of them: - Definition of REAL Python-based classes over the web (like ZClasses); everything I mention below should also work with these new over-the-web classes - Being able to define template-like classes (like "Meta-ZClasses"); e.g. you'd have a predefined "Persons" ZClass and could use it to derive a special "Co-Workers" or "Customers" class by just adding/changing stuff - Wizards for the basic tasks (like creating a new ZClass; you'd not have to click through all the definition tabs after the basic creation of the ZClass); the wizards framework exists already - Defining basic "components" like data class, presentation class, etc. - A forms builder framework (with the help of Martijn Faassen's Formulator, this part is quite advanced already) - being able to define objects from UML tools - roundtrip engineering (from UML tools etc. to Zope and back); there already are tools to get ZClass structures into the Object Domains UML software ... - providing a lot of frequently needed basic modules to the programmer/power user; the Content Management Framework is a basic attempt to do this Cheers Joachim -
participants (2)
-
Joachim Werner -
Mark James Adams