[CMF-checkins] CVS: CMF/CMFDefault/skins/zpt_control -
members_add.py:1.1 members_delete.py:1.1
validateMemberIds.py:1.1 validatePassword.py:1.1
Yvo Schubbe
y.2004_ at wcm-solutions.de
Tue Jun 1 13:02:44 EDT 2004
Update of /cvs-repository/CMF/CMFDefault/skins/zpt_control
In directory cvs.zope.org:/tmp/cvs-serv4792/CMFDefault/skins/zpt_control
Added Files:
members_add.py members_delete.py validateMemberIds.py
validatePassword.py
Log Message:
- factored out the controllers and validators for members_manage_form / join_form
=== Added File CMF/CMFDefault/skins/zpt_control/members_add.py ===
## Script (Python) "members_add"
##parameters=member_id, password, member_email, send_password=False, **kw
##title=Add a member
##
from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.permissions import ManageUsers
mtool = getToolByName(script, 'portal_membership')
ptool = getToolByName(script, 'portal_properties')
rtool = getToolByName(script, 'portal_registration')
try:
rtool.addMember( id=member_id, password=password,
properties={'username': member_id,
'email': member_email} )
except ValueError, errmsg:
return context.setStatus(False, errmsg)
else:
if ptool.getProperty('validate_email') or send_password:
rtool.registeredNotify(member_id)
if mtool.checkPermission(ManageUsers, mtool):
return context.setStatus(True, 'Member registered.')
else:
return context.setStatus(False, 'Success!')
=== Added File CMF/CMFDefault/skins/zpt_control/members_delete.py ===
## Script (Python) "members_delete"
##parameters=ids, **kw
##title=Delete members
##
from Products.CMFCore.utils import getToolByName
mtool = getToolByName(script, 'portal_membership')
mtool.deleteMembers(ids)
return context.setStatus( True, 'Selected member%s deleted.' %
( len(ids) != 1 and 's' or '' ) )
=== Added File CMF/CMFDefault/skins/zpt_control/validateMemberIds.py ===
## Script (Python) "validateMemberIds"
##parameters=ids=(), **kw
##title=
##
if ids:
return context.setStatus(True)
else:
return context.setStatus(False, 'Please select one or more members first.')
=== Added File CMF/CMFDefault/skins/zpt_control/validatePassword.py ===
## Script (Python) "validatePassword"
##parameters=password='', confirm='', **kw
##title=
##
from Products.CMFCore.utils import getToolByName
ptool = getToolByName(script, 'portal_properties')
rtool = getToolByName(script, 'portal_registration')
if ptool.getProperty('validate_email'):
password = rtool.generatePassword()
return context.setStatus(True, password=password)
else:
result = rtool.testPasswordValidity(password, confirm)
if result:
return context.setStatus(False, result)
else:
return context.setStatus(True)
More information about the CMF-checkins
mailing list