def import_vul_ui():
 date = request.utcnow
 post_vars = request.post_vars
 location_id = post_vars.location
 update_super = s3db.update_super
 ss_table = s3db.stats_source
 source_id = ss_table.insert(name='Vulnerability indicators submitted through UI')
 vdoc_table = s3db.vulnerability_document
 id = vdoc_table.insert(document_type='indicator', date=date, location_id=location_id, source_id=source_id)
 update_super(vdoc_table, dict(id=id))
 itable = s3db.vulnerability_indicator
 rows = db((itable.deleted == False)).select(itable.posn, itable.parameter_id, orderby=itable.posn)
 vd_table = db.vulnerability_data
 for row in rows:
  id = vd_table.insert(parameter_id=row.parameter_id, location_id=location_id, value=post_vars[str(row.posn)], date=date, source_id=source_id)
  update_super(vd_table, dict(id=id))

def import_vul_ui ( ) : date = request . utcnow post_vars = request . post_vars location_id = post_vars . location update_super = s3db . update_super ss_table = s3db . stats_source source_id = ss_table . insert ( name = 'Vulnerability indicators submitted through UI' ) vdoc_table = s3db . vulnerability_document id = vdoc_table . insert ( document_type = 'indicator' , date = date , location_id = location_id , source_id = source_id ) update_super ( vdoc_table , dict ( id = id ) ) itable = s3db . vulnerability_indicator rows = db ( ( itable . deleted == False ) ) . select ( itable . posn , itable . parameter_id , orderby = itable . posn ) vd_table = db . vulnerability_data for row in rows : id = vd_table . insert ( parameter_id = row . parameter_id , location_id = location_id , value = post_vars [ str ( row . posn ) ] , date = date , source_id = source_id ) update_super ( vd_table , dict ( id = id ) )
controller to add a new set of vulnerability indicators which have been input direct into the gui .