Tip: Click lines to highlight, hold ctrl/cmd to multi-select
http://codedumper.com/adawu (30-May @ 17:50)
Syntax Highlighted Code
- class Register(Master):
- """Register an InternalPrincipal add an IUser"""
- def update(self, login=None, password=None, password_repeat=None, fname=None, lname=None, email=None):
- if login is not None:
- pau = component.getUtility(IAuthentication)
- principals = pau['principals']
- if login not in principals:
- name = fname + ' ' + lname
- principals[login] = user = InternalPrincipal(login, password, name)
- role_manager = IPrincipalRoleManager(self.context)
- role_manager.assignRoleToPrincipal('Tpi.User', login)
- user = IUser(user) #pass it the InternalPrincipal object for adaption
- user.email = email
- user.fname = fname
- user.lname = lname
Plain Code
class Register(Master):
"""Register an InternalPrincipal add an IUser"""
def update(self, login=None, password=None, password_repeat=None, fname=None, lname=None, email=None):
if login is not None:
pau = component.getUtility(IAuthentication)
principals = pau['principals']
if login not in principals:
name = fname + ' ' + lname
principals[login] = user = InternalPrincipal(login, password, name)
role_manager = IPrincipalRoleManager(self.context)
role_manager.assignRoleToPrincipal('Tpi.User', login)
user = IUser(user) #pass it the InternalPrincipal object for adaption
user.email = email
user.fname = fname
user.lname = lname