Ideally this should return the string returned by google as to WHY it failed, but the following is far better than silence.

diff -r 917ae7c81790 location/geocoding/
--- a/location/geocoding/     Mon Sep 27 20:05:31 2010 -0400
+++ b/location/geocoding/     Tue Sep 28 13:55:26 2010 -0400
@@ -130,6 +130,7 @@
   preg_match('/<code>(.*)<\/code>/', $http_reply->data, $status_code_match);
   $status_code = $status_code_match[1];
   if ($status_code != 200) {
+    watchdog('location', t('Google geocoding returned: %status_code', array('%status_code' => $status_code)));
     return NULL;
@@ -137,6 +138,7 @@
   preg_match('/Accuracy="([0-9])"/', $http_reply->data, $accuracy_code_match);
   $accuracy_code = $accuracy_code_match[1];
   if ($accuracy_code < variable_get('location_geocode_' . $location['country'] . 'google_accuracy_code', variable_get('location_geocode_google_minimum_accuracy', '3'))) {
+    watchdog('location',t('Google geocoding accuracy: %accuracy_code', array('%accuracy_code' => $accuracy_code)));
     return NULL;
#2 location_925480.patch1.15 KBtobiasb
google.inc_.patch2.08 KBDanGarthwaite
Members fund testing for the Drupal project. Drupal Association Learn more


sethcohn’s picture


tobiasb’s picture

Status: Needs review » Reviewed & tested by the community
1.15 KB
rooby’s picture

Status: Reviewed & tested by the community » Fixed

When setting issues to RTBC it is good to give some sort of comment like that you have tested it (and how you tested it if it is not obvious) and it works or something. Especially if no one else has commented anything along those lines.
Also, when adding a new patch you should say why. How it is different from the patches before.

I have committed a slightly modified version of the patch to all versions.
Changes I made were:
* Removed t() from the watchdog() calls as watchdog handles that itself (except for in drupal 5).
* Changed the accuracy message to make it more useful.
* Added the changes to location_geocode_au_google() in also. Geocoding functionalities can be overridden per country in these include files. In this case the only country that has code relevant to this patch was Australia.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.