[Zope-dev] invokeFactory problem

Declan Shanaghy dshanaghy@350nice.com
Fri, 1 Aug 2003 14:07:56 -0700 (PDT)


I have a portal_type called ClientBill.
I can create it by using the folder_factories script no
problem.

I want to create one in the users home folder
programatically, when they register in the portal.

I have been able to do stuff like this before no problem so
i copied and pasted the (other working) code and customized
it to this.

request = container.REQUEST
RESPONSE =  request.RESPONSE

portal = context.portal_url.getPortalObject()
myPath=context.portal_url.getRelativeUrl(context)

contact = context.sql_getContact(username=username)
homeFolder =
portal.portal_membership.getHomeFolder(id=username)

if contact and homeFolder:
  if (int(contact[0]['ContactTypeId']) ==
int(context.CONTACT_TYPE_CLIENT)):
    homeFolder.invokeFactory(type_name='ClientBill',
id='Monthly_Bill', title='Services you will be billed for',
remote_url=myPath)
    #clientBill = getattr( homeFolder, "Monthly_Bill" )
   
#clientBill.propertysheets.ClientBill.manage_changeProperties(request)

RESPONSE.redirect("contactList?ContactTypeId=" +
str(context.CONTACT_TYPE_CLIENT))



The problem is that i get this error when i execute the
script. (specifically, on the invokeFactory line)

Error Type: KeyError
Error Value: id

I cant see why im getting this error, anyone have any
suggestions?

Thanks in advance for any help.
Dek