ZopeMag's mascot the ZOPE fish

Listing 8 - _doChangeUser() in DBUserFolder.py




1.	def _doChangeUser( self, login, lname = None, fname = None, email = None, password = None, roles = None, domains = None ):
2.	     "edit existing user"

3.	     # create dictionary 
4.	     dict = {}
5.	     dict[ 'login' ] = _formatText( login )
6.	     if fname is not None:
7.	          dict[ 'fname' ] = _formatText( fname )
8.	     if lname is not None:
9.	          dict[ 'lname' ] = _formatText( lname )
10.	     if email is not None:
11.	          dict[ 'email' ] = _formatText( email )
12.	     if password is not None and password != '':
13.	          password = base64.encodestring( md5.new( password ).digest() )
14.	          dict[ 'password' ] = password

15.	     # format roles
16.	     if type( roles )==type( '' ):
17.	          roles=[ roles, ]
18.	     roles = string.join( roles, ',' )
19.	     dict[ 'roles' ] = _formatText( roles )

20.	     # format domains
21.	     domains = string.join( domains, ',' )
22.	     dict[ 'domains' ] = _formatText( domains )

23.	     # update data record in user table
24.	     apply( self.editUserQuery, (), dict )



Home   Subscribe   FAQ   Contact   Write for us   Privacy Policy   Weekly News   PyZine   opensourcexperts.com  

Reproduction of material from any of ZopeMag's pages without prior written permission is strictly prohibited. Copyright 2003 - 2005 ZopeMag Zope/Plone hosting by Nidelven IT