def hrm_credential_controller():
 if (current.session.s3.hrm.mode is not None):
  current.session.error = current.T('Access denied')
  redirect(URL(f='index'))
 s3 = current.response.s3
 def prep(r):
  table = r.table
  if (r.method in ('create', 'create.popup', 'update', 'update.popup')):
   person_id = r.get_vars.get('~.person_id', None)
   if person_id:
    field = table.person_id
    field.default = person_id
    field.readable = field.writable = False
  if r.record:
   table.person_id.comment = None
   table.person_id.writable = False
  return True
 s3.prep = prep
 return current.rest_controller('hrm', 'credential')

def hrm_credential_controller ( ) : if ( current . session . s3 . hrm . mode is not None ) : current . session . error = current . T ( 'Access denied' ) redirect ( URL ( f = 'index' ) ) s3 = current . response . s3 def prep ( r ) : table = r . table if ( r . method in ( 'create' , 'create.popup' , 'update' , 'update.popup' ) ) : person_id = r . get_vars . get ( '~.person_id' , None ) if person_id : field = table . person_id field . default = person_id field . readable = field . writable = False if r . record : table . person_id . comment = None table . person_id . writable = False return True s3 . prep = prep return current . rest_controller ( 'hrm' , 'credential' )
restful crud controller - could be used for searching for people by skill - used for adding/editing on profile page .