def survey_updateMetaData(record, qtype, metadata):
 metatable = current.s3db.survey_question_metadata
 question_id = record.id
 if isinstance(metadata, str):
  metadata_list = json2py(metadata)
 else:
  metadata_list = metadata
 for (desc, value) in metadata_list.items():
  desc = desc.strip()
  if (not isinstance(value, str)):
   value = json.dumps(value)
  value = value.strip()
  metatable.insert(question_id=question_id, descriptor=desc, value=value)
 if (qtype == 'Grid'):
  widget_obj = survey_question_type['Grid']()
  widget_obj.insertChildren(record, metadata_list)

def survey_updateMetaData ( record , qtype , metadata ) : metatable = current . s3db . survey_question_metadata question_id = record . id if isinstance ( metadata , str ) : metadata_list = json2py ( metadata ) else : metadata_list = metadata for ( desc , value ) in metadata_list . items ( ) : desc = desc . strip ( ) if ( not isinstance ( value , str ) ) : value = json . dumps ( value ) value = value . strip ( ) metatable . insert ( question_id = question_id , descriptor = desc , value = value ) if ( qtype == 'Grid' ) : widget_obj = survey_question_type [ 'Grid' ] ( ) widget_obj . insertChildren ( record , metadata_list )
function to update the metadata of a question corresponding to the record .