Re: [Zope] ZClasses problem
Alex Rice <alrice@swcp.com> writes:
Has anyone been able to create ZClasses via an external method? Can you send me a snippet of code? Thanks, what I'm trying to do is below.
Alex
*Note there was a typo below. I said Etext/ where I meant Etexts/
------- Start of forwarded message ------- Date: Sun, 27 Jun 1999 18:06:25 -0600 (MDT) Message-Id: <199906280006.SAA27366@inago.swcp.com> From: Alex Rice <alrice@swcp.com> To: zope@zope.org Subject: [Zope] ZClasses problem X-Mailman-Version: 1.0b8 Precedence: bulk List-Id: Users of the Z Object Publishing Environment <zope.zope.org> X-BeenThere: zope@zope.org
I'm trying to create some ZClasses via an external method, but I'm running into a problem: I can't getattr() the product's methods. For instance, I have a Product called Etexts, containing
a zclass etext a dtml method etext_add (etext constructor) a dtml method etext_addForm (etext constructor input form) a factory etext_factory (etext factory)
I can go anywhere in my Zope heirarchy, and in an external method, I can getattr() to manage_addProduct/Etext, but when I try to getattr() to manage_addProduct/Etext/etext, etext_add, or etext_addForm, I get an AttributeError.
Have you tried to getattr() self.Control_Panel.Products.Etexts.etext_add? -Michel
On 29 Jun 1999 23:36:46 -0400, michel@digicool.com said: michel> Have you tried to getattr() michel> self.Control_Panel.Products.Etexts.etext_add? Yep, I can do that, but I get an error when I call it. Here is what I'm seeing. I created a Product Foo with a ZClass foo in it, with foo_add, foo_addForm and foo_factory. I created an external method that that makes these calls. Here are the calls and results: # this gets an Attribute Error on 'Foo' (not 'foo') self.manage_addProduct.Foo.foo(id='hi') # this appears to do nothing self.Control_Panel.Products.Foo.foo(id='hi') # this gets a NameError on foo.createInObjectManager() self.Control_Panel.Products.Foo.foo_add(id='hi') # this creates an object 'hi' in Products/Foo -- not in the current folder self.Control_Panel.Products.Foo.foo.createInObjectManager('hi', {}) How do I create a ZClass in the current folder using an external method? I feel like the answer is probably going to slap me across the head RSN but I've been stumped on this for a few days now. Thanks for any pointers, satori, etc. Alex Rice | alrice@swcp.com | http://www.swcp.com/~alrice Current Location: N. Rio Grande Bioregion, Southwestern USA
participants (2)
-
Alex Rice -
michel@digicool.com