[Zope-CMF] Re: Copy folder contents on first login?

Ignacio Valdes ivaldes at hal-pc.org
Tue Dec 27 09:08:47 EST 2005


Hi! Thanks for the reply. I customized login_initial before I came 
across createMemberDefault. Which one is preferred? It has been a long 
time so it isn't clear to me from what I read how (and/or where?) you 
put createMemberDefault. Is it a dtml method? If so, where should it 
reside?

Instead I customized login_initial to the following which doesn't work 
so well because the new id has to be a Manager to work:

if context.validate_email:
     state.set(status='login_change_password')
# Copy the default tree into their user space.
REQUEST=context.REQUEST
portal_properties = context.portal_properties
portal_registration = context.portal_registration

default_user = 'default_doc' #name of member folder where your default 
user docs are kept.

# username = context.REQUEST.username

username=context.portal_membership.getAuthenticatedMember().getId()

uf = container.portal_membership.getHomeFolder(username)

#XXXobject.manage_permission('View',('Manager','Member','Owner',),acquire=0)
#give the roles in the list the permission to Add Documents, etc... 
 for that folder.
#listofroles = ['Member', 'Owner','Manager']

#I don't quite understand why the script runs proxy as manager, yet 
one still must give anonymous the following permissions?
listofroles = ['Anonymous']
uf.manage_permission('Add Documents, Images, and Files', listofroles, 
acquire=1)
uf.manage_permission('Add portal content', listofroles, acquire=1)
uf.manage_permission('Delete objects', listofroles, acquire=1)

user_defaults = 
container.portal_membership.getHomeFolder(default_user)

#obs = 
container.user_defaults.manage_copyObjects(container.user_defaults.objectIds())
obs = user_defaults.manage_copyObjects(user_defaults.objectIds())

uf.manage_pasteObjects(obs)

return state

On Tue, 27 Dec 2005 12:32:25 +0100
  Raphael Ritz <r.ritz at biologie.hu-berlin.de> wrote:
> Ignacio Valdes wrote:
>> Hello all,
>> 
>> It has been years since I've last developed in CMF 1.0 for Linux 
>>Medical 
>> News http://www.linuxmednews.com project database. I'm back, this 
>>time 
>> working on a new web application for a research project on clinical 
>> outcomes using Plone 2.1.1
>> 
>> I would like to copy the contents of folder 'default' at 
>> home/members/webmaster's home/default the first time a new member 
>>logs 
>> in. I've looked around on Zopelabs and found this: 
>> http://www.zopelabs.com/cookbook/1042820556
>> 
>> I plan on customizing portal_skins/plone_login/login_initial but am 
>>not 
>> sure how exactly to code this since I've done miniscule amounts of 
>> Python. Please give me a nudge in the right direction.
> 
> You might want to consider using the hooks provided
> by the MembershipTool for that. In Plone - I think -
> it is still 'notifyMemberAreaCreated' while in
> CMFDefault it is 'createMemberContent'.
> 
> But a Python script with this id in one of your
> skin folders and do whatever content creation/customization
> you see fit.
> 
> Rapahel
> 
>> 
>> Thanks!
>> 
>> -- IV
>> _______________________________________________
>> Zope-CMF maillist  -  Zope-CMF at lists.zope.org
>> http://mail.zope.org/mailman/listinfo/zope-cmf
>> 
>> See http://collector.zope.org/CMF for bug reports and feature 
>>requests
>> 
>> 
> 
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF at lists.zope.org
> http://mail.zope.org/mailman/listinfo/zope-cmf
> 
> See http://collector.zope.org/CMF for bug reports and feature 
>requests



More information about the Zope-CMF mailing list