[Zope-CMF] Re: allow managers to use setMemberProperties() method
David Bain
pigeonflight@yahoo.co.uk
Mon, 17 Mar 2003 15:19:02 -0500
It's working nicely now, but I altered the python script abit.
my version looks like this:
username = proxyuser
request = context.REQUEST
##just need to add some code that loops through the values
mapping = {'fullname': request['fullname']
,'email': request['email']
}
container.setAMembersProperties(username, mapping)
request.RESPONSE.redirect('urltoredirectto')
Thanks alot
(I should probably put my recipe up at zopelabs)
Troy Farrell wrote:
> 1) html_form:
>
> <form action="pyscript">
> <input type="text" name="username"/>
> <input type="name" name="name"/>
> <input type="text" name="email"/>
> <input type="submit"/>
> </form>
>
> 2)pyscript:
>
> username = request.has_key('username') and request.username
> mapping = {'name': request.has_key('name') and request.name
> ,'email': request.has_key('email') and request.email
> }
>
> # ideally you would do some error checking and input data cleanup.
> # someone with permission to execute setAMembersProperties
> # might abuse the lack of data checking to change values you don't
> # want changed.
>
> container.setAMembersProperties(username, mapping)
> request.RESPONSE.redirect('anypage')
>
> Troy
>
> David Bain wrote:
>> Okay, so far so good.
>> now to integrate a context.REQUEST into the mix, so that I can easily run
>> a through the web version.
>>
>> Troy Farrell wrote:
>>
>>
>>>Ok. Handholding (no assumptions, ok, a few assumptions):
>>>1) Create a file in the Zope/Extensions directory called 'memprop.py'
>>>2) Put the function below in that file
>>>3) Create an external method:
>>>
>>>Id: setAMembersProperties
>>>Title: We don't care
>>>Module Name: memprop
>>>Function Name: setAMembersProperties
>>>
>>>4) Set pemissions so that only the groups who need it can 'View', 'Take
>>>ownership', 'Change permissions' and 'Access contents information'
>>>5)Create a python script to call your external method:
>>>
>>>username = 'bob'
>>>mapping = {'name': 'Bob Jones'
>>> ,'email': 'me@yahoo.com'
>>> }
>>>container.setAMembersProperties(username, mapping)
>>>
>>>6) Adjust accordingly.
>>>
>>>Troy
>
>
> _______________________________________________
> Zope-CMF maillist - Zope-CMF@zope.org
> http://mail.zope.org/mailman/listinfo/zope-cmf
>
> See http://collector.zope.org/CMF for bug reports and feature requests
--
-I don't have much use for this signature thing