[Zope-CMF] how to modify the add user method?
josh@pdxbands.com
josh@pdxbands.com
Thu, 16 Aug 2001 00:39:46 -0700
It's been a while but I found time to finish this up and try this out. Now
I'm a bit stuck. It is my lack of knowledge I'm sure.
I have this program from Marc(thanks) and I want to call it after a user
registers. I understand the program and how it will work but don't
understand how I call the program. I have the script registered as in my
user_defaults directory. I also have a pic in there. I think I should be
able to call it with the call:
<dtml-call expr="container.user_defaults.createUserDefaults()">
in regester in my custom directory but that program doesn't appear to be
called. I thought that the custom folder was called instead of the control
if the file existed.
Ok, so maybe I'm just totally confused. Could someone direct me to where I
can understand how to call a script if I'm even close to understanding this?
or give me a better understanding of what I'm doing wrong.
I think my eyes are going now. I'll have to go through the zope book
tomorrow I think.
Thanks for the help.
Josh
--__--__--
Message: 5
Date: Thu, 02 Aug 2001 00:21:42 -0400
Subject: Re: [Zope-CMF] how to modify the add user method?
From: marc lindahl <marc@bowery.com>
To: <zope-cmf@zope.org>
I did this, and was going to put together a how-to, haven't had time yet.
But basically, in register.dtml, called this script
(createUserDefaults.pys), which I'll put below. Modified registered.dtml
also, so that I could print a result string from the function (optional
geekiness). Also, the .pys had to have a proxy role of owner in order to
work. Here's the pythonscript (the lines will probably be wrapped in the
wrong place...):
#copy stuff from user_defaults to user folder, build default mypic image
#depends on folder user_defaults with everything there copied
#and an image user_default_mypic both in the same folder as this script
#
uf = container.portal_membership.getHomeFolder(username)
uf.manage_permission('Add Documents, Images, and Files', ['Anonymous',
'Member', 'Owner','Manager','Reviewer'], 1)
uf.manage_permission('Add portal content', ['Anonymous', 'Member',
'Owner','Manager','Reviewer'], 1)
obs =
container.user_defaults.manage_copyObjects(container.user_defaults.objectIds
())
uf.manage_pasteObjects(obs)
#uf.mypic.manage_setLocalRoles(username, ['Owner'])
#change this one back, since we're operating in a known, limited situation
uf.manage_permission('Add Documents, Images, and Files', [], 1)
uf.manage_permission('Add portal content', [], 1)
return 'Set up ' + `uf.getId()` +' with default content '+
`container.user_defaults.objectIds()`