[Zope-CMF] ?Adding ZClasses registered as Portal Types

Brad Clements bkc@murkworks.com
Wed, 22 Aug 2001 11:48:16 -0400


On 22 Aug 2001 at 11:47, Tim Hoffman wrote:

> But if I go to the portal_types tool directly rather than going via 
> getToolByName
> it does find the constructor method in for my ZClass but doesn't seem to
> pass 'id' correctly to it. The example above used 'Folder' which is a
> default type, but I get the same result with my own types.
> 
> Can anyone give me some hints.

I've been fighting something like this from a Python Script today. I found that I had to 
put id into the REQUEST object. See r.set() call below:


r = context.REQUEST
username=r['username']
company=r['company']

if (not company) or (not username):
   raise ValueError('You must specify a company name and username')

homeFolder = context.portal_membership.getHomeFolder(id=username)
homeFolder.manage_changeProperties(title=company)


r.set('id','CompanyInfo')
homeFolder.invokeFactory(id='CompanyInfo',type_name='CompanyInformation')

co=getattr(homeFolder,'CompanyInfo')
co.propertysheets.InternalInfo.manage_changeProperties(CompanyName=company)



Brad Clements,                bkc@murkworks.com   (315)268-1000
http://www.murkworks.com                          (315)268-9812 Fax
netmeeting: ils://ils.murkworks.com               AOL-IM: BKClements