[Zope-dev] Using Python script to create ZClass instances
Bjorn Stabell
bjorn@exoweb.net
Thu, 12 Apr 2001 22:17:33 +0800
After hours of fiddling around, I've already given up Python methods,
but I can't even instantiate MySubZclass via External Methods?!?!?
MyProduct . MyZClass . MySubZClass
1. folder.manage_addProduct['MyProduct'].MyZClass.MySubZClass_add(id)
-> AttributeError for MySubZClass_add
2.
folder.manage_addProduct['MyProduct'].propertysheets.methods['MySubZClas
s_add'](id)
-> NameError on MySubZClass (at least it gets to the constructor
method)
I really think one of the major pains of Zope is just instantiating
objects... It's HELL hard, and NOT intuitive.
-----Original Message-----
From: Bjorn Stabell=20
Posted At: Thursday, April 12, 2001 12:02
Posted To: Zope Developer
Conversation: [Zope-dev] How do I call an HTMLFile in context provided
by apath?
Subject: [Zope-dev] Using Python script to create ZClass instances
Hi there,
Im having problems using Python script to create a ZClass instance from
a ZClass that's inside of another ZClass. I have this addMyObject
Python script as constructor script for "Scriptable Type Information"
type object (CMF):
## Script (Python) "addMyObject"
##bind container=3Dcontainer
##bind context=3Dcontext
##bind namespace=3D
##bind script=3Dscript
##bind subpath=3Dtraverse_subpath
##parameters=3Dfolder, id
##title=3D
##
=09
folder.Control_Panel.Products.MyProducts.MyObjects.MyObject_add(id)
# folder.manage_addProduct('MyProduct')... doesn't work either
item =3D getattr(folder, id)
return item
MyObjects is a ZClass that contains MyObject. The error I get is:
Zope error
Error type AttributeError=20
Error value MyObjects
There should be some explanation somewhere how to access resources
inside of Control_Panel, but I fail to find it. Creating objects is
very confusing and difficult at times...
Bye,
--=20
Bjorn Stabell <bjorn@exoweb.net>
_______________________________________________
Zope-Dev maillist - Zope-Dev@zope.org
http://lists.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -=20
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope )