Index: usps.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ecommerce/contrib/shipcalc/partners/usps.inc,v
retrieving revision 1.1.2.5.4.1
diff -u -p -r1.1.2.5.4.1 usps.inc
--- usps.inc	9 Aug 2007 23:55:07 -0000	1.1.2.5.4.1
+++ usps.inc	22 Nov 2007 19:33:26 -0000
@@ -167,8 +167,8 @@ function usps_settings_form_submit(&$for
   if ($form_values['shipping_partner'] == 'usps') {
     variable_set('shipcalc_usps_userid', $form_values['usps_userid']);
     variable_set('shipcalc_usps_password', $form_values['usps_password']);
-    variable_set('shipcalc_usps_url', $form_values['usps_url']);
-    variable_set('shipcalc_usps_test_url', $form_values['usps_test_url']);
+    variable_set('shipcalc_usps_url', trim($form_values['usps_url']));
+    variable_set('shipcalc_usps_test_url', trim($form_values['usps_test_url']));
   }
   if ($op == t('Test usps configuration')) {
     $txn->address['shipping']->zip = 20008;
@@ -176,7 +176,12 @@ function usps_settings_form_submit(&$for
     // 
     $request = '<RateV2Request USERID="'. variable_get('shipcalc_usps_userid', '') .'" PASSWORD="'. variable_get('shipcalc_usps_password', '') .'"><Package ID="0"><Service>All</Service><ZipOrigination>10022</ZipOrigination><ZipDestination>20008</ZipDestination><Pounds>10</Pounds><Ounces>5</Ounces><Size>LARGE</Size><Machinable>TRUE</Machinable></Package></RateV2Request>';
     $rates = usps_get_rates($txn, $form_values['usps_test_url'], TRUE, $request);
-    drupal_set_message(theme('shipcalc_testing_results', $rates));
+    if ($rates) {
+      drupal_set_message(t('Shipcalc testing first rate found: @foundRates .', array('@foundRates' => $rates[0]['#cost'])), 'status');
+    }
+    else {
+      drupal_set_message('Error processing test.', 'error');
+    }
   }
 }
 
