Index: content_profile.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/user_import/supported/content_profile.inc,v
retrieving revision 1.1
diff -u -p -r1.1 content_profile.inc
--- content_profile.inc	24 Oct 2009 21:10:47 -0000	1.1
+++ content_profile.inc	22 Jul 2010 11:43:58 -0000
@@ -112,20 +112,38 @@ if (module_exists('node_import') && modu
       $field_key = !empty($field_data[2]) ? $field_data[2] : 'value';
       $field_value = array(0 => array($field_key => $column_data[0]));
 
-      if (!$updated) {
-        $node->{$field_name} = $field_value;
-      }
-      elseif ($updated && $update_setting == UPDATE_ADD) {
+      if (!strcmp($field_data[0],'location_cck')) {
+        // hack - location_cck:country expects a country code
+        // node_import_values() should have been run on every field, which would in turn have called
+        // the 'preprocess' function defiend in that field, which would do the name->code lookup.
+        // This does NOT appear to be happening, so we hack it here
+        //
+        // The correct solution would be to find out why no fields are being validated in user_import
+        if (!strcmp($field_key,'country')) {
+          $allowed=array_merge(array('xx' => 'NOT LISTED'), location_get_iso3166_list());
+          if ( array_key_exists(strtolower($column_data[0]),$allowed) ) {
+            // make sure the index is in lowercase
+            $column_data[0]=strtolower($column_data[0]);
+          } else {
+            $column_data[0]=array_search($column_data[0],$allowed);
+          };
+        };
+      } else {
+        if (!$updated) {
+          $node->{$field_name} = $field_value;
+        }
+        elseif ($updated && $update_setting == UPDATE_ADD) {
 
-        $current_content = content_format($field_name, $node->{$field_name}[0], 'default', $node);
+          $current_content = content_format($field_name, $node->{$field_name}[0], 'default', $node);
 
-        if (empty($current_content) && !empty($column_data[0])) { 
-					$node->{$field_name} = $field_value;
+          if (empty($current_content) && !empty($column_data[0])) { 
+            $node->{$field_name} = $field_value;
+          }
         }
+        elseif ($updated && $update_setting == UPDATE_REPLACE) {
+          $node->{$field_name} = $field_value; 
+        }  
       }
-      elseif ($updated && $update_setting == UPDATE_REPLACE) {
-        $node->{$field_name} = $field_value; 
-      }  
     }
     
 		// not actually checking for errors at the moment, but lete's leave this in for when we do
