def gis_layer_onaccept(form):
 enable = current.request.post_vars.enable
 if enable:
  db = current.db
  s3db = current.s3db
  ctable = s3db.gis_config
  query = (ctable.uuid == 'SITE_DEFAULT')
  config = db(query).select(ctable.id, limitby=(0, 1)).first()
  if (not config):
   return
  config_id = config.id
  layer_id = form.vars.layer_id
  ltable = s3db.gis_layer_config
  query = ((ltable.config_id == config_id) & (ltable.layer_id == layer_id))
  record = db(query).select(ltable.id, limitby=(0, 1)).first()
  if record:
   db(query).update(enabled=True)
  else:
   ltable.insert(config_id=config_id, layer_id=layer_id, enabled=True)

def gis_layer_onaccept ( form ) : enable = current . request . post_vars . enable if enable : db = current . db s3db = current . s3db ctable = s3db . gis_config query = ( ctable . uuid == 'SITE_DEFAULT' ) config = db ( query ) . select ( ctable . id , limitby = ( 0 , 1 ) ) . first ( ) if ( not config ) : return config_id = config . id layer_id = form . vars . layer_id ltable = s3db . gis_layer_config query = ( ( ltable . config_id == config_id ) & ( ltable . layer_id == layer_id ) ) record = db ( query ) . select ( ltable . id , limitby = ( 0 , 1 ) ) . first ( ) if record : db ( query ) . update ( enabled = True ) else : ltable . insert ( config_id = config_id , layer_id = layer_id , enabled = True )
process the enable checkbox .