Tip: Click lines to highlight, hold ctrl/cmd to multi-select
http://codedumper.com/ategu (29-May @ 05:15)
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):
- # TODO: validate password is equal to password_repeat
- # add principal to principal folder
- 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)
- # save the email to an IUser instance
- user = IUser(user) #pass it the InternalPrincipal object for adaption
- user.email = email
- user.fname = fname
- user.lname = lname
- principalRoleManager.assignRoleToPrincipal('Tpi.Employee', login)
- else:pass
- else:pass
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):
# TODO: validate password is equal to password_repeat
# add principal to principal folder
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)
# save the email to an IUser instance
user = IUser(user) #pass it the InternalPrincipal object for adaption
user.email = email
user.fname = fname
user.lname = lname
principalRoleManager.assignRoleToPrincipal('Tpi.Employee', login)
else:pass
else:pass