Tip: Click lines to highlight, hold ctrl/cmd to multi-select

http://codedumper.com/ategu (29-May @ 05:15)

Syntax Highlighted Code

  1. class Register(Master):
  2.     """Register an InternalPrincipal add an IUser"""
  3.     def update(self, login=None, password=None, password_repeat=None, fname=None, lname=None, email=None):
  4.         # TODO: validate password is equal to password_repeat    
  5.         # add principal to principal folder
  6.         if login is not None:
  7.             pau = component.getUtility(IAuthentication)
  8.             principals = pau['principals']
  9.             if login not in principals:
  10.                 name = fname + ' ' + lname
  11.                 principals[login] = user = InternalPrincipal(login, password, name)
  12.                 # save the email to an IUser instance
  13.                 user = IUser(user) #pass it the InternalPrincipal object for adaption
  14.                 user.email = email
  15.                 user.fname = fname
  16.                 user.lname = lname
  17.                 principalRoleManager.assignRoleToPrincipal('Tpi.Employee', login)
  18.             else:pass
  19.         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

Permalink: http://codedumper.com/ategu