[Zope] Creating ZClass from Python Script

Casey Duncan cduncan@kaivo.com
Wed, 15 Aug 2001 13:02:16 -0600


Chris Bruce wrote:
> 
> I looked through the archives but could find something specific to my
> scenario.  How would you create a ZClass programatically from an
> external python method with only the ZClass name as string?  Is that
> even possible?
> 
> I am trying to write an external method that can import a csv file
> into a ZClass that you specify.  I am pretty close, but getting hung
> up on how to create the ZClass?
> 
> Thanks in advance.
> 
> Chris
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

You need to know the product name as well. The code is then:

instance = context.manage_addProduct['Product Name']['ZClass
Name'].ZClass_add(context)

Where ZClass_add is the name of the constructor DTML method.

hth,
-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>