Commits

Peter Sanchez committed 26dadec

Added shortcuts.py

  • Participants
  • Parent commits 86d1885
  • Branches trunk

Comments (0)

Files changed (2)

File webutils/djtools/shortcuts.py

+from django.template import RequestContext
+from django.shortcuts import render_to_response
+
+def quick_response(request, template, context={}):
+    return render_to_response(
+        template,
+        context,
+        context_instance=RequestContext(request),
+    )

File webutils/geocode.py

 from geopy import geocoders, distance
+from geopy.geocoders.google import GQueryError
 
 
 class GeoCode(object):
             return None
 
         g = geocoders.Google(self.api_key)
-        res = g.geocode(location, exactly_one=False)
+        try:
+            res = g.geocode(location, exactly_one=False)
+        except GQueryError:
+            return None
+            
         if isinstance(res, tuple):
             return res
         else: