def job():
 def prep(r):
  if (r.method == 'datalist'):
   from s3 import s3_set_default_filter
   s3_set_default_filter('~.status', 'OPEN', tablename='work_job')
   if (r.representation == 'html'):
    filter_formstyle = settings.get_ui_formstyle()
    s3db.configure('work_job', filter_formstyle=filter_formstyle)
  if (not r.component):
   r.resource.configure(create_next=r.url(method=''), update_next=r.url(method=''))
  elif (r.component_name == 'assignment'):
   ctable = r.component.table
   field = ctable.person_id
   logged_in_person = auth.s3_logged_in_person()
   if logged_in_person:
    query = (((ctable.job_id == r.id) & (ctable.person_id == logged_in_person)) & (ctable.deleted != True))
    existing = db(query).select(ctable.id, limitby=(0, 1)).first()
    if (not existing):
     field.default = logged_in_person
    else:
     field.default = None
  return True
 s3.prep = prep
 def postp(r, output):
  if ((r.representation == 'html') and (r.method == 'datalist')):
   response.view = 'work/joblist.html'
   script = ('s3.work.js' if s3.debug else 's3.work.min.js')
   path = ('/%s/static/scripts/S3/%s' % (appname, script))
   if (path not in s3.scripts):
    s3.scripts.append(path)
   current.menu.options = None
  return output
 s3.postp = postp
 return s3_rest_controller(rheader=s3db.work_rheader)

def job ( ) : def prep ( r ) : if ( r . method == 'datalist' ) : from s3 import s3_set_default_filter s3_set_default_filter ( '~.status' , 'OPEN' , tablename = 'work_job' ) if ( r . representation == 'html' ) : filter_formstyle = settings . get_ui_formstyle ( ) s3db . configure ( 'work_job' , filter_formstyle = filter_formstyle ) if ( not r . component ) : r . resource . configure ( create_next = r . url ( method = '' ) , update_next = r . url ( method = '' ) ) elif ( r . component_name == 'assignment' ) : ctable = r . component . table field = ctable . person_id logged_in_person = auth . s3_logged_in_person ( ) if logged_in_person : query = ( ( ( ctable . job_id == r . id ) & ( ctable . person_id == logged_in_person ) ) & ( ctable . deleted != True ) ) existing = db ( query ) . select ( ctable . id , limitby = ( 0 , 1 ) ) . first ( ) if ( not existing ) : field . default = logged_in_person else : field . default = None return True s3 . prep = prep def postp ( r , output ) : if ( ( r . representation == 'html' ) and ( r . method == 'datalist' ) ) : response . view = 'work/joblist.html' script = ( 's3.work.js' if s3 . debug else 's3.work.min.js' ) path = ( '/%s/static/scripts/S3/%s' % ( appname , script ) ) if ( path not in s3 . scripts ) : s3 . scripts . append ( path ) current . menu . options = None return output s3 . postp = postp return s3_rest_controller ( rheader = s3db . work_rheader )
flag method as a long running job .