#NEWLINE# def _location_to_fixture( location_db , location , type ) : #NEWLINE# #INDENT# root = Element ( type . code , { #NEWLINE# #INDENT# 'id' : location . location_id , #NEWLINE# #UNINDENT# } ) #NEWLINE# fixture_fields = [ 'name' , 'site_code' , 'external_id' , 'latitude' , 'longitude' , 'location_type' , 'supply_point_id' ] #NEWLINE# for field in fixture_fields : #NEWLINE# #INDENT# field_node = Element ( field ) #NEWLINE# val = getattr ( location , field ) #NEWLINE# field_node . text = unicode ( ( val if ( val is not None ) else '' ) ) #NEWLINE# root . append ( field_node ) #NEWLINE# #UNINDENT# root . append ( _get_metadata_node ( location ) ) #NEWLINE# _append_children ( root , location_db , location_db . by_parent [ location . location_id ] ) #NEWLINE# return root