Merged with Sverre
authorSverre Rabbelier <sverre@rabbelier.nl>
Tue, 26 May 2009 00:19:09 +0200
changeset 2349 5a5e3d84b43e
parent 2348 0edff67b472d (current diff)
parent 2346 d830123c1be1 (diff)
child 2350 a6764395c7e9
Merged with Sverre
--- a/app/soc/logic/models/base.py	Mon May 25 23:45:20 2009 +0200
+++ b/app/soc/logic/models/base.py	Tue May 26 00:19:09 2009 +0200
@@ -25,6 +25,8 @@
   ]
 
 
+import logging
+
 from google.appengine.ext import db
 
 from django.utils.translation import ugettext
@@ -324,7 +326,13 @@
 
     query = self.getQueryForFields(filter=filter, order=order)
 
-    result = query.fetch(limit, offset)
+    try:
+      result = query.fetch(limit, offset)
+    except db.NeedIndexError, exception:
+      result = []
+      logging.exception("%s, model: %s filter: %s, order: %s" % 
+                        (exception, self._model, filter, order))
+      # TODO: send email
 
     if unique:
       return result[0] if result else None