jueves, 26 de marzo de 2009

Creando usuarios programaticamente en Plone


from Products.CMFCore.utils import getToolByName
#Primero pedimos la portal_registration tool
pr = getToolByName(context, 'portal_registration')
id = 'id_usuario'
password = 'password'
#En este diccionario cargamos campos adicionales
props = {
'username' : id,
'fullname' : 'Nombre Completo',
'email' : 'email_del_usuario',
}

pr.addMember(id, password, properties=props)


API: http://api.plone.org/CMF/2.1.0/public/frames/products/CMFCore/products.CMFCore.MembershipTool.MembershipTool-class.html#addMember